SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 05/03/2011, 03:10 PM   #1
Madsen
Big Clucker
 
Join Date: Jan 2011
Posts: 151
Reputation: 0
Default respawn all vehicles

i am trying to make a command that respawns all vehicles this is what i have made so far
Code:
// at the top
new vehicles[MAX_VEHICLES];

// OnPlayerCommandText(playerid, cmdtext[])

if (strcmp("/respawnallvehicles", cmdtext, true, 10) == 0)
	{
   	 	RepairVehicle(vehicles[MAX_VEHICLES]);
		SetVehicleToRespawn(vehicles[MAX_VEHICLES]);
		return 1;
	}
Madsen is offline  
Old 05/03/2011, 03:17 PM   #2
HyperZ
High-roller
 
HyperZ's Avatar
 
Join Date: Aug 2009
Location: Islamabad, Pakistan
Posts: 1,340
Reputation: 66
Default Re: respawn all vehicles

Command:
pawn Code:
if (strcmp("/respawnallvehicles", cmdtext, true, 10) == 0)
{
    for(new cars=0; cars<MAX_VEHICLES; cars++)
    {
        if(!VehicleOccupied(cars))
        {
            SetVehicleToRespawn(cars);
            RepairVehicle(cars);
        }
    }
    return 1;
}
Somewhere in your script:
pawn Code:
forward VehicleOccupied(vehicleid);
public VehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}
HyperZ is offline  
Old 05/03/2011, 11:40 PM   #3
Madsen
Big Clucker
 
Join Date: Jan 2011
Posts: 151
Reputation: 0
Default Re: respawn all vehicles

hmm xD, i was not even close :P
Madsen 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
Does the streamer respawn the vehicles? Ihsan_Cingisiz Help Archive 4 03/08/2010 10:14 PM
Respawn all vehicles BP13 Help Archive 5 10/12/2009 03:39 PM
Respawn All Vehicles command. Badger(new) Help Archive 4 21/05/2009 10:41 PM
Vehicles don't respawn PoWerZ Help Archive 0 08/04/2009 08:48 AM


All times are GMT. The time now is 08:31 PM.


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