SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Prev Previous Post   Next Post Next
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  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Respawn vehicles.. DevilRP Scripting Help 10 10/03/2012 01:39 PM
Vehicles don't respawn. Ash. Help Archive 1 26/06/2011 07:25 AM
respawn all vehicles Madsen Help Archive 2 05/03/2011 11:40 PM
Respawn all vehicles BP13 Help Archive 5 10/12/2009 03:39 PM
Vehicles don't respawn PoWerZ Help Archive 0 08/04/2009 08:48 AM

All times are GMT. The time now is 09:15 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.