SA-MP Forums Archive
Will this work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Will this work? (/showthread.php?tid=350777)



Will this work? - a!DaN)_)-) - 13.06.2012

Код:
CMD:respawncars(playerid, params[]) {
	if(playerVariables[playerid][pAdminLevel] >= 4) {
       	if(!IsPlayerInAnyVehicle(playerid)) return 0;
       	else
 		{
		SetAllVehiclesToRespawn();
		SendClientMessage(playerid, COLOR_WHITE, "All vehicles have been respawned.");
		}
	}
	return 1;
}



Re: Will this work? - JaTochNietDan - 13.06.2012

Why would you ask if it works, wait for a response from someone who is going to look at it and make an assumption on whether or not it works by guessing what you want it to do etc.

Why not just go test it yourself and get a result in seconds?


Re: Will this work? - Stevee - 13.06.2012

Just to point out, the command is set to check if the player using the command is in a car, totally excluding the other players on the server.


Re: Will this work? - a!DaN)_)-) - 13.06.2012

Ok well i want the command to respawn all unocupied vehicles and leave the ones what have players in.


Re: Will this work? - Djole1337 - 13.06.2012

Код:
CMD:respawnallcars(playerid, params[])
{
    new sendername[30];
	if(playerVariables[playerid][pAdminLevel] >= 4)
	{
    for(new car = 0; car <= 268; car++)
    if((IsVehicleEmpty(car) && !IsTrailerAttachedToVehicle(car) && GetVehicleModel(car) !=435 && GetVehicleModel(car) !=450 && GetVehicleModel(car) !=584 && GetVehicleModel(car) !=591) || (IsVehicleEmpty(car) && IsTrailerAttachedToVehicle(car) !=GetVehicleTrailer(car)))
    {
        SetVehicleToRespawn(car);
    }
    GetPlayerName(playerid,sendername,sizeof(sendername));
    SendClientMessage(playerid, COLOR_WHITE, "All vehicles have been respawned.");
	}
	else SendClientMessage(playerid, COLOR_RED, "Command not found! Type /cmds to see a list of available commands.");
 	return 1;
}



Re: Will this work? - a!DaN)_)-) - 13.06.2012

error 017: undefined symbol "IsVehicleEmpty"


Re: Will this work? - Djole1337 - 13.06.2012

Quote:
Originally Posted by a!DaN)_)-)
Посмотреть сообщение
error 017: undefined symbol "IsVehicleEmpty"
Код:
stock IsVehicleEmpty(vehicleid)
{
        for(new i=0; i<MAX_PLAYERS; i++)
        {
                if(IsPlayerInVehicle(i, vehicleid)) return 0;
        }
        return 1;
}