SA-MP Forums Archive
[HELP] Car Respawner [+REP] - 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: [HELP] Car Respawner [+REP] (/showthread.php?tid=327486)



[HELP] Car Respawner [+REP] - [PDS]DarioKeic - 21.03.2012

Hello,
I was wondering if somebody may please make me a script where every 3 min all unused cars from /v delete
and all unused cars that are static respawn in there normal place. I will +REP Asap to the first person to
help me.

Thank you.


Re: [HELP] Car Respawner [+REP] - viddo - 21.03.2012

Well, This is a command to respawn all cars for admins
Код:
	if(strcmp(cmd, "/respawnallcars", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        if(PlayerInfo[playerid][pAdmin] < 4)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "** you are not an admin...");
			    return 1;
			}
			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);
			}
			GameTextForAll("~w~Every Unused Car ~n~~g~Respawned!",5000,1);
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Respawned All Unused Cars",d,m,y,h,mi,s,sendername);
			AdminLog(string);
		}
		return 1;
	}
If you know how to set a timer for something then you will be able to set a timer that makes the above without a command.


Re: [HELP] Car Respawner [+REP] - [PDS]DarioKeic - 21.03.2012

Im sorry, Im just a beginner in PAWNO. May you please make that for me?
Thank you for the help. +REP


Re: [HELP] Car Respawner [+REP] - Kudoz - 21.03.2012

pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** you are not an admin...");
                return 1;
            }
            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);
            }
            GameTextForAll("~w~Every Unused Car ~n~~g~Respawned!",5000,1);
            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Respawned All Unused Cars",d,m,y,h,mi,s,sendername);
            AdminLog(string);
        }
        return 1;
    }
btw this is viddo's script. Just add it to your script.

- Kudoz


Re: [HELP] Car Respawner [+REP] - viddo - 21.03.2012

Quote:
Originally Posted by Kudoz
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/respawnallcars", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "** you are not an admin...");
                return 1;
            }
            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);
            }
            GameTextForAll("~w~Every Unused Car ~n~~g~Respawned!",5000,1);
            new y, m, d;
            new h,mi,s;
            getdate(y,m,d);
            gettime(h,mi,s);
            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Respawned All Unused Cars",d,m,y,h,mi,s,sendername);
            AdminLog(string);
        }
        return 1;
    }
btw this is viddo's script. Just add it to your script.

- Kudoz
By the way, This is a defined admin script, just replace your admin system with
Код:
	        if(PlayerInfo[playerid][pAdmin] < 4)
			{
			    SendClientMessage(playerid, COLOR_GRAD1, "** you are not an admin...");
			    return 1;
			}
If you want it for Rcon You can just use:
Код:
  if(IsPlayerAdmin(playerid))
  			{
			    SendClientMessage(playerid, COLOR_GRAD1, "** you are not an admin...");
			    return 1;
			}