help with errors
#1

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
Reply
#2

SHow the code
Reply
#3

This is the line: foreach(new i:Player){
Reply
#4

Remplace with :
Quote:

foreach(new i = 0; i < MAX_PLAYERS; i++){

Reply
#5

maybe you forgot to add this
pawn Код:
new Player;
Reply
#6

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
Reply
#7

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.
Reply
#8

wat?
Reply
#9

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.
Reply
#10

Код:
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);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)