Help please! - 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)
+--- Thread: Help please! (
/showthread.php?tid=571382)
Help please! -
Jakwob - 18.04.2015
Hey guys im making a createspike code have this but i was wondering how i could get max players, as its giving errors. any help would be great and will +rep for the help.
pawn Код:
Createspike(Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
for(new p = 0; p < sizeof(MAX_PLAYERS); p++)
{
if(SpikeInfo[i][SpikeCreated] == 0)
{
SpikeInfo[i][SpikeCreated]=1;
SpikeInfo[i][SpikeX]=x;
SpikeInfo[i][SpikeY]=y;
SpikeInfo[i][SpikeZ]=z-0.7;
SpikeInfo[i][SpikeObject] = CreateDynamicObject(2899, x, y, z-0.88, 0, 0, Angle-90);
SpikeInfo[i][SpikeOwner] = GetName(p);
return 1;
}
}
}
return 0;
}
Код:
C:\Documents and Settings\SAMP\Desktop\SA-MP 0.3.7\filterscripts\Spikes1.pwn(120) : error 020: invalid symbol name ""
C:\Documents and Settings\SAMP\Desktop\SA-MP 0.3.7\filterscripts\Spikes1.pwn(120) : error 029: invalid expression, assumed zero
C:\Documents and Settings\SAMP\Desktop\SA-MP 0.3.7\filterscripts\Spikes1.pwn(120) : warning 215: expression has no effect
C:\Documents and Settings\SAMP\Desktop\SA-MP 0.3.7\filterscripts\Spikes1.pwn(120) : error 017: undefined symbol "p"
C:\Documents and Settings\SAMP\Desktop\SA-MP 0.3.7\filterscripts\Spikes1.pwn(120) : fatal error 107: too many error messages on one line
Re: Help please! -
Azula - 18.04.2015
PHP код:
Createspike(playerid,Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[i][SpikeCreated] == 0)
{
SpikeInfo[i][SpikeCreated]=1;
SpikeInfo[i][SpikeX]=x;
SpikeInfo[i][SpikeY]=y;
SpikeInfo[i][SpikeZ]=z-0.7;
SpikeInfo[i][SpikeObject] = CreateDynamicObject(2899, x, y, z-0.88, 0, 0, Angle-90);
SpikeInfo[i][SpikeOwner] = GetName(playerid);
return 1;
}
}
return 0;
}
PHP код:
Createspike(playerid,Float:x,Float:y,Float:z,Float:Angle);
Re: Help please! -
Chausar - 18.04.2015
Your problem was at the "p" the fifth line.
Re: Help please! -
Jakwob - 18.04.2015
Thanks guy i sorted it myself

thanks anyway
pawn Код:
Createspike(Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
//for(new p = 0; p < sizeof(MAX_PLAYERS); p++) *The Code Was Wrong*
for(new p=0; p<MAX_PLAYERS; p++)
{
if(SpikeInfo[i][SpikeCreated] == 0)
{
SpikeInfo[i][SpikeCreated]=1;
SpikeInfo[i][SpikeX]=x;
SpikeInfo[i][SpikeY]=y;
SpikeInfo[i][SpikeZ]=z-0.7;
SpikeInfo[i][SpikeObject] = CreateDynamicObject(2899, x, y, z-0.88, 0, 0, Angle-90);
SpikeInfo[i][SpikeOwner] = GetName(p);
return 1;
}
}
}
return 0;
}
I have Rep'd you both
Re: Help please! -
Chausar - 20.04.2015
Glad it working.