01.08.2011, 13:22
Hello, i got problem with my cars owner ship system, to get car id i need to have playerid first, how to get it under OnVehicleSpawn
for(new playerid; playerid < MAX_PLAYERS; playerid++;)
test.pwn(534) : error 001: expected token: ")", but found ";" test.pwn(534) : error 036: empty statement test.pwn(534) : error 029: invalid expression, assumed zero test.pwn(534) : fatal error 107: too many error messages on one line
for(new playerid; playerid < MAX_PLAYERS; playerid++;)
Код:
test.pwn(534) : error 001: expected token: ")", but found ";" test.pwn(534) : error 036: empty statement test.pwn(534) : error 029: invalid expression, assumed zero test.pwn(534) : fatal error 107: too many error messages on one line pawn Код:
|
for(new i = 0; i < MAX_PLAYERS; i++)
new Herro[MAX_PLAYERS];
public OnVehicleSpawn(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++) {
new Float:x,Float:y,Float:z;
GetPlayerPos(i,Float:x,Float:y,Float:z);
Herro[i] = CreateVehicle(411,Float:x,Float:y,Float:z,100.0,1,1,15);
}
return 1;
}
Well, firstly you can NOT use playerid in a loop, since it's already defined. This one is correct:
pawn Код:
|
public OnVehicleDeath(vehicleid)
{
new playerid;
for(playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(IsPlayerInVehicle(playerid, vehicleid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
break;
}
SendClientMessage(playerid, 0xFFFFFFFF, "What did you do to your vehicle?!");
return true;
}