//at the top we have this:
new gPlayerCheckpointStatus[MAX_PLAYERS];
//then this follows to set the checkpoint coordinates (they're not set on the right coordinates though)
public OnPlayerSpawn(playerid)
{
SetPlayerToTeamColor(playerid);
printf("OnPlayerSpawn(%d)", playerid);
SetPlayerWorldBounds(playerid, -2276.0679,-2556.1008, 1584.9418,1514.6514);
SetPlayerCheckpoint(playerid,-2432.6494,1549.2205,34.4020, 2);
gPlayerCheckpointStatus[playerid] = 26;
SetPlayerCheckpoint(playerid,1992.5996,2050.9978,10.5662, 2);
gPlayerCheckpointStatus[playerid] = 27;
SetPlayerCheckpoint(playerid,1919.1919,1919.1919,10.3333,2);
gPlayerCheckpointStatus[playerid] = 28;
if(savedmoney[playerid] > 4)
{
GivePlayerMoney(playerid,(savedmoney[playerid]));
}
return 1;
}
// then we have this to set what happens at the checkpoints
public OnPlayerEnterCheckpoint(playerid)
{
new Float:health;
switch (gPlayerCheckpointStatus[playerid])
{
case 26:
{
GetPlayerHealth(playerid,health);
GetPlayerMoney(playerid);
if(health < 50)
{
if(GetPlayerMoney(playerid) > 19)
{
SetPlayerHealth(playerid,80);
SendClientMessage(playerid, COLOR_GREEN, "Your health has been raised.");
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid,-20);
}
else
{
SendClientMessage(playerid, COLOR_RED, "You need 20$.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You're healthy enough!");
}
}
}
switch (gPlayerCheckpointStatus[playerid])
{
case 27:
{
if (GetPlayerTeam(playerid) == 0 && GetPlayerMoney(playerid) > 99)
{
GivePlayerWeapon(playerid, 38, 100);
GivePlayerMoney(playerid,-100);
GameTextForPlayer(playerid, "Minigun Purchased!", 3000, 3);
}
else
{
SendClientMessage(playerid, COLOR_RED,"You need 100$ to buy a Minigun or you are on the other team.");
}
}
}
switch (gPlayerCheckpointStatus[playerid])
{
case 28:
{
if (GetPlayerTeam(playerid) == 1 && GetPlayerMoney(playerid) > 99)
{
GivePlayerWeapon(playerid, 38, 100);
GivePlayerMoney(playerid,-100);
GameTextForPlayer(playerid, "Minigun Purchased!", 3000, 3);
}
else
{
SendClientMessage(playerid, COLOR_RED,"You need 100$ to buy a Minigun or you are on the other team.");
}
}
}
}