help with errors - 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 with errors (
/showthread.php?tid=556719)
help with errors -
RuNBoY - 11.01.2015
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(36) : warning 201: redefinition of constant/macro (symbol "foreach")
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 029: invalid expression, assumed zero
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 017: undefined symbol "Player"
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 029: invalid expression, assumed zero
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : fatal error 107: too many error messages on one line
how to fix them
Re: help with errors -
bgedition - 11.01.2015
SHow the code
Re: help with errors -
RuNBoY - 11.01.2015
This is the line: foreach(new i:Player){
Re : help with errors -
StreetRP - 11.01.2015
Remplace with :
Quote:
foreach(new i = 0; i < MAX_PLAYERS; i++){
|
Re: help with errors -
bgedition - 11.01.2015
maybe you forgot to add this
Re: help with errors -
RuNBoY - 11.01.2015
New errors
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 017: undefined symbol "foreach"
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 029: invalid expression, assumed zero
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : error 017: undefined symbol "i"
C:\Users\LIETOT~1\AppData\Local\Temp\Rar$DIb0.356\[V]Group.pwn(1685) : fatal error 107: too many error messages on one line
Re: help with errors -
dominik523 - 11.01.2015
pawn Код:
foreach(Player, i)
{
// code
}
Quote:
Originally Posted by StreetRP
Remplace with :
Код:
foreach(new i = 0; i < MAX_PLAYERS; i++){
|
foreach is for using iterators, and what you wrote is just using simple loops.
Re: help with errors -
RuNBoY - 11.01.2015
wat?
Re: help with errors -
dominik523 - 11.01.2015
Try to replace your foreach(new i:Player){ with the code I wrote.
EDIT: actually, I've only seen people using foreach to loop through players only like that. So I guess that makes no difference.
Sorry I don't know what is causing your errors.
Re: help with errors -
RuNBoY - 11.01.2015
Код:
stock SetVehicleVelocityM(vehicleid,Float:x,Float:y,Float:z)
{
new playerid=INVALID_PLAYER_ID;
foreach(new i = 0; i < MAX_PLAYERS; i++){
if(ivehicle[i] == vehicleid){
playerid = i;
break;
}
}
if(playerid != INVALID_PLAYER_ID){
new hizi = floatround(floatsqroot((x * x + y * y + z * z)) * 200.2);
SetPVarInt(playerid,"sonhiz",hizi);
}
return SetVehicleVelocity(vehicleid,x,y,z);
}