array help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: array help (
/showthread.php?tid=94815)
array help -
sggassasin - 01.09.2009
hey i need some help im useing a streemer and i need an array so that i can go and have 5 pos for enter and 5 pos for exit so could someone help
Код:
YCP_OnPlayerEnterCheckpoint(playerid);
thx for ur time
Re: array help -
Clavius - 01.09.2009
pawn Код:
// TOP
#define CPCOUNT 5 // change this if you need more CP's
#define CP_SIZE 8.0 // CP size
#define CP_RANGE 50.0 // view distance
new CPID[CPCOUNT]; // this stores the CP id's
new Float:CPData[CPCOUNT][3] =
{
{0.0, 0.0, 0.0}, // add X, Y and Z coordinates
{10.0, 10.0, 10.0},
{20.0, 20.0, 20.0},
{30.0, 30.0, 30.0},
{40.0, 40.0, 40.0} // no comma needed here
}; // and this stores the CP positions (X Y Z)
// OnGameModeInit()
for (new i = 0; i < CPCOUNT; i++)
{
CPID[i] = SetStreamCheckpoint(CPData[i][0], CPData[i][1], CPData[i][2], CP_SIZE, CP_RANGE);
}
// [...]
OnPlayerEnterStreamCheckpoint(playerid, checkpointid)
{
switch (checkpointid)
{
case CPID[0]:
{
// what happens when you enter CP #0
}
case CPID[1]:
{
// what happens when you enter CP #1
}
// and so on
}
}
But make sure YCP is installed properly before you use it!
Re: array help -
sggassasin - 01.09.2009
ok with that i get these errers
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(1332) : error 021: symbol already defined: "OnPlayerEnterStreamCheckpoint"
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(1335) : error 008: must be a constant expression; assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(1339) : error 008: must be a constant expression; assumed zero
Re: array help -
Clavius - 01.09.2009
You have the OnPlayerEnterStreamCheckpoint(playerid, checkpointid) function twice. Remove one of them.
Re: array help -
sggassasin - 01.09.2009
no i dont
Re: array help -
sggassasin - 02.09.2009
hey i need some help i have these errors now .... C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(1335) : error 008: must be a constant expression; assumed zero
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(133
: warning 217: loose indentation
C:\Program Files\Rockstar Games\GTA San Andreas\samp sever\gamemodes\cops&robbers.pwn(1340) : error 008: must be a constant expression; assumed zero