Easy Checkpoints help. -
ricardo178 - 10.06.2011
Hello guys!
I am making my Bus Job system, and i want it to display a checkpoint, the player go there and earn 10$, then, it display an other checkpoint, bla bla bla....
I've made a checkpoint that does this, but it is only one.
When the player go there, he earn the money but it doesn't display an other checkpoint in other side...
My code is:
pawn Код:
COMMAND:startbroute1(playerid, params[])
{
if(PlayerInfo[playerid][Fmember] == 6)
{
SetPlayerCheckpoint(playerid, 1239.824462, -1716.014770, 13.385701, 3.0);
return 1;
}
else return SendClientMessage(playerid, 0xFFFF00, "You are not Bus Driver.");
}
public OnPlayerEnterCheckpoint(playerid)
{
GivePlayerMoney(playerid, 10);
DisablePlayerCheckpoint(playerid);
return 1;
}
How do i make it to multiple checkpoints?
Thank you in advance.
Re: Easy Checkpoints help. -
Sascha - 10.06.2011
I'd suggest you using an array..
like:
pawn Код:
new Float:BCP[][3] =
{
{x, y, z}, //coords of the 1. cp
{x, y, z}, //coords of the 2. cp
{x, y, z}, //coords of the 3. cp
{x, y, z} //coords of the 4. cp ....etc.
};
new pCP[MAX_PLAYERS];
now set the pCP (checkpoint variable) to -1 when the player connects ( = the player didn't start the mission yet
pawn Код:
public OnPlayerConnect(playerid)
{
pCP[playerid] = -1;
}
then on your command
(get sure that the first coordinates (x, y, z) are the same coords as you've entered in the command)
and then for the checkpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(pCP[playerid] != -1)
{
GivePlayerMoney(playerid, 10);
if(pCP[playerid] < sizeof(BCP))
{
pCP[playerid]++;
SetPlayerCheckPoint(playerid, BCP[pCP[playerid]][0], BCP[pCP[playerid]][1], BCP[pCP[playerid]][2]);
}
else
{
SendClientMessage(playerid, 0x999999AA, "Route finished");
DisablePlayerCheckpoint(playerid);
pCP[playerid] = -1;
}
}
return 1;
}
(not tested, just wrote it up)
Re: Easy Checkpoints help. -
ricardo178 - 10.06.2011
Thank you very much... I only get 1 warmning.... It is important:
Код:
C:\Users\Ricardo\Desktop\Script-Programaзгo\Script SA-MP\MyRP\MyRP\MyRP\gamemodes\myrp.pwn(1782) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
The line is the SetPlayerCheckpoint one.
pawn Код:
new Float:BCP[][3] =
{
{1239.824462, -1716.014770, 13.385701},
{1339.824462, -1716.014770, 13.385701},
{1439.824462, -1716.014770, 13.385701},
{1539.824462, -1716.014770, 13.385701}
};
new pCP[MAX_PLAYERS];
COMMAND:startbroute1(playerid, params[])
{
if(PlayerInfo[playerid][Fmember] == 6)
{
pCP[playerid] = 0;
return 1;
}
else return SendClientMessage(playerid, 0xFFFF00, "You are not Bus Driver.");
}
public OnPlayerEnterCheckpoint(playerid)
{
if(pCP[playerid] != -1)
{
GivePlayerMoney(playerid, 10);
if(pCP[playerid] < sizeof(BCP))
{
pCP[playerid]++;
SetPlayerCheckpoint(playerid, BCP[pCP[playerid]][0], BCP[pCP[playerid]][1], BCP[pCP[playerid]][2]);
}
else
{
SendClientMessage(playerid, 0x999999AA, "Route finished");
DisablePlayerCheckpoint(playerid);
pCP[playerid] = -1;
}
}
return 1;
}
Re: Easy Checkpoints help. -
ricardo178 - 10.06.2011
Sorry for double posting.
I fixed it myself but now it doesn't show any error, but when i type the command, it doesn't show up anything....
Thank you.
Re: Easy Checkpoints help. -
sleepysnowflake - 10.06.2011
Notice the 4. You added that ?
Re: Easy Checkpoints help. -
Wesley221 - 10.06.2011
You need to create the checkpoint aswell in the command
Re: Easy Checkpoints help. -
Sascha - 10.06.2011
Quote:
Originally Posted by Berlovan
Notice the 4. You added that ?
|
I didn't add that "4" on purpose dude... the 4 shadows the used lines aka. checkpoints. As you don't know how long his route is, you can also leave blank.
show us your new cmd^^
Re: Easy Checkpoints help. -
ricardo178 - 10.06.2011
It is solved.
![Cheesy](images/smilies/biggrin.png)
Thank you very much.
I will not forget your name in the Credits.
Re: Easy Checkpoints help. -
Sascha - 10.06.2011
no problem dude.. that's what I'm here for^^