View Single Post
Old 04/08/2011, 04:05 AM   #1
grand.Theft.Otto's Avatar
Join Date: Sep 2010
Location: Canada
Posts: 1,059
Reputation: 65
Default Respawn vehicles

I am looking for a command, which respawns empty/unused cars and cars that are not at their default spawn position.

I have this at the moment:

pawn Code:
    if(PlayerInfo[playerid][Level] >= 3|| IsPlayerAdmin(playerid))
        for(new i = 0; i < MAX_VEHICLES; i++)
            for(new x = 0; x < MAX_PLAYERS; x++)
                    SendClientMessageToAll(COLOR_GREEN,"All Vehicles Have Been Respawned To Their Default Spawn Positions By An Admin.");
                    SendClientMessage(playerid,COLOR_LIGHTBLUE,"You Respawned All The Vehicles.");
    } else return SendClientMessage(playerid,red,"Invalid Command. Type   /cmds   For A List Of All Available Server Commands.");

But the problem is (I'm sure it's because of the loops) is that it spams the chat with the messages which is because for each car it respawns, it spams. It then lags my game and sometimes freezes the computer, which forces me to restart. Can someone edit this code or tell me what I've done wrong?

I want the empty cars that are not at their default spawn position to be spawned, not ones that are occupied.


grand.Theft.Otto is offline