09.12.2013, 16:46
You dont need 2 times loop for MAX_PLAYERS
// EDIT
Wrong placed return 1; so unknown command appears
pawn Код:
if(strcmp(cmdtext, "/tower", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new PlayerID[50],SeatID[50],cnt,i;
for(i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
if(i == playerid) continue;
if(GetPlayerVehicleID(i) != vehicleid) continue;
new VSeat = GetPlayerVehicleSeat(i);
PlayerID[cnt] = i;
SeatID[cnt] = (-1 < VSeat < sizeof(PlayerID)) ? VSeat : cnt+1;
++cnt;
}
SetVehiclePos(vehicleid, 1544.2318, -1354.3735, 329.4725);
SetVehicleZAngle(vehicleid, 100.0);
for(i = 0; i < cnt; i++)
PutPlayerInVehicle(PlayerID[i], vehicleid, SeatID[i]);
}
return 1;
}
Wrong placed return 1; so unknown command appears
pawn Код:
if(strcmp(cmdtext, "/tower", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, 1544.2318, -1354.3735, 329.4725);
SetVehicleZAngle(vehicleid, 100);
}
else
{
SetPlayerPos(playerid, 1541.3450,-1366.5369,329.7969);
SetPlayerFacingAngle(playerid, 360);
}
return 1;
}