CMD:respawnarmy(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Dibutuhkan admin LVL 1+");
}
else
{
for(new x;x<sizeof(ARMYVehicles);x++)
{
if(!IsVehicleOccupied(x))
{
SetVehicleToRespawn(ARMYVehicles[x]);
}
}
SendClientMessageToAll(COLOR_REALRED,"[Information] {FFFFFF}Kendaraan faction ARMY telah Direspawn.");
}
return 1;
}
stock IsVehicleOccupied(vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
return 1;
}
}
return 0;
}
new bool:unwanted[MAX_VEHICLES];
foreach(Player, i)
{
if(IsPlayerInAnyVehicle(i))
{
unwanted[GetPlayerVehicleID(i)] = true;
}
}
if(!unwanted[car])
CMD:respawnarmy(playerid)
{
if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessageEx(playerid, COLOR_WHITE, "Dibutuhkan admin LVL 1+");
for(new x;x<sizeof(ARMYVehicles);x++)
{
if(!IsVehicleOccupied(ARMYVehicles[x])
SetVehicleToRespawn(ARMYVehicles[x]);
}
SendClientMessageToAll(COLOR_REALRED,"[Information] {FFFFFF}Kendaraan faction ARMY telah Direspawn.");
return 1;
}
|
You were passing the iterator to the parameter of the IsVehicleOccupied function, whereas you needed to pass the vehicle ID stored in the ARMYVehicles array, simply change !IsVehicleOccupied(x) to !IsVehicleOccupied(ARMYVehicles[x]).
|
stock IsVehicleOccupied(vehicleid)
{
new state = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i, vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
state = 1;
}
}
return state;
}
|
otherwise it could work.
PHP код:
you don't had a correct return value. |
C:\Users\gratiotio\Desktop\MGP\gamemodes\a.pwn(67322) : error 001: expected token: "-identifier-", but found "state" C:\Users\gratiotio\Desktop\MGP\gamemodes\a.pwn(67327) : error 001: expected token: "-identifier-", but found "=" C:\Users\gratiotio\Desktop\MGP\gamemodes\a.pwn(67327) : error 029: invalid expression, assumed zero C:\Users\gratiotio\Desktop\MGP\gamemodes\a.pwn(67327) : warning 215: expression has no effect C:\Users\gratiotio\Desktop\MGP\gamemodes\a.pwn(67330) : error 001: expected token: "-identifier-", but found ";"
|
otherwise it could work.
PHP код:
you don't had a correct return value. |
stock
IsVehicleOccupied(vehicleid)
|
why do you use
PHP код:
PHP код:
|
|
Thats the most meaningless thing i ever heard, this affects the performance in no way. Show me a benchmark to 'stop the abuse of stock' otherwise you're following posts blindly.
|