error 017: undefined symbol "i" - 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: error 017: undefined symbol "i" (
/showthread.php?tid=376817)
error 017: undefined symbol "i" -
kbalor - 11.09.2012
Title says it all..
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:armour[MAX_PLAYERS];
GetPlayerArmour(playerid, armour[playerid]);
if( armour[playerid] > 0.0 )
{
SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 1242, 1, 0.019999, 0.039999, 0.000000, 2.459999, 89.699989, -3.100000, 1.710000, 2.119999, 1.719999);//броня
}
else if( armour[playerid] == 0.0 && IsPlayerAttachedObjectSlotUsed(i, ARMOUR_INDEX))
{
RemovePlayerAttachedObject(playerid, ARMOUR_INDEX); // armour
}
return 1;
}
More info:
https://sampforum.blast.hk/showthread.php?pid=1010610#pid1010610
Well, there are too many codes given on that topic. I don't know what the best.
Re: error 017: undefined symbol "i" -
Roach_ - 11.09.2012
Try this:
pawn Код:
public OnPlayerUpdate(playerid)
{
new Float:armour[MAX_PLAYERS];
GetPlayerArmour(playerid, armour[playerid]);
if( armour[playerid] > 0.0 )
{
SetPlayerAttachedObject( playerid, ARMOUR_INDEX, 1242, 1, 0.019999, 0.039999, 0.000000, 2.459999, 89.699989, -3.100000, 1.710000, 2.119999, 1.719999);
}
else if( armour[playerid] == 0.0 && IsPlayerAttachedObjectSlotUsed( playerid, ARMOUR_INDEX ) )
{
RemovePlayerAttachedObject(playerid, ARMOUR_INDEX); // armour
}
return 1;
}
Re: error 017: undefined symbol "i" -
[MWR]Blood - 11.09.2012
I guess you want to run a loop through all object slots - something like that:
https://sampwiki.blast.hk/wiki/IsPlayerA...ObjectSlotUsed
Re: error 017: undefined symbol "i" -
kbalor - 11.09.2012
@roach thanks tried with 2 players and working
@MWR yes, thats what i meant +rep. Anyway it's solved now. Also I'm avoiding some bug if ever it exist on the codes I have posted.