SA-MP Forums Archive
/rac(Respawn all cars) it works but I wanna add smth simple to it - 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: /rac(Respawn all cars) it works but I wanna add smth simple to it (/showthread.php?tid=371000)



/rac(Respawn all cars) it works but I wanna add smth simple to it - Guitar - 22.08.2012

Hey guys, I have scripted a "Respawn All cars" command, so, what I wanna add into the command is

1) If a player is in a vehicle, his vehicle doesn't get respawned
2) Only the unoccupied/unused vehicles get respawned.

pawn Код:
CMD:rac(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    for(new i = 0; i < MAX_VEHICLES; i++)
    {
        SetVehicleToRespawn(i);
    }
    new string[128];
    new pName[24];
    GetPlayerName(playerid,pName,24);
    format(string,sizeof string,""#COL_ORANGE"[SERVER]"#COL_LRED"%s has respawned all the server's vehicles!",pName);
    SendClientMessageToAll(COLOR_GREEN, string);
    return 1;
}



Re: /rac(Respawn all cars) it works but I wanna add smth simple to it - Akira297 - 22.08.2012

Код:
CMD:rac(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 2)
	{
		new string[128];
		new bool:unwanted[MAX_VEHICLES];
		for(new player=0; player<MAX_PLAYERS; player++)
     	{
            if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
     	}
		for(new car = 1; car <= 1850; car++)
		{
			if(!unwanted[car]) SetVehicleToRespawn(car);
		}
		SendClientMessageEx(playerid, COLOR_GREY, "You have respawned all unused vehicles.");
		format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has just respawned all unused cars.", GetPlayerNameEx(playerid));
		ABroadCast(COLOR_YELLOW, string, 1);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
	}
	return 1;
}



Re: /rac(Respawn all cars) it works but I wanna add smth simple to it - Guitar - 22.08.2012

It's working, thank you, I've added some reputation points to you. I really needed this, thank you again! However, I really need some people like you to help me out, please add me on xFire " justinallica "!


Re: /rac(Respawn all cars) it works but I wanna add smth simple to it - Akira297 - 22.08.2012

I've never liked, XFire. Any other communication programs?

i.e Skype?

XxLight_AngelxX


Re: /rac(Respawn all cars) it works but I wanna add smth simple to it - Guitar - 22.08.2012

Yup I've got skype, I will be adding you, it's justinallica too!