[FilterScript] Vehicles Auto Repair
#1

VEHICLES AUTO REPAIR SYSTEM
Код:
#include <a_samp>
Description:
Hey guys this is my New FilterScript of VEHICLES AUTO REPAIR SYSTEM By SkulleR

- Full Auto Repair!
- /Ar or /Autorepair Command to "Disable / Enable"!


Pawn code:
Код:
///////////////////////////////////////////////////////////////////////////////
//Simple Vehicle Auto Repair [FULL] By SkulleR
//Please The Credits
//Website: www.SWX-Stunting.Ga
//Enjoy it
///////////////////////////////////////////////////////////////////////////////

#include <a_samp>
forward AutoRepair();
forward AutoFlipReset();

new AutoRepairUsed[MAX_PLAYERS];
new AutoRepairTrigger[MAX_PLAYERS];

#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Auto Repair Filter Script By SkulleR");
	print("--------------------------------------\n");
	SetTimer("AutoRepair", 1001, true);
	SetTimer("AutoFlipReset", 6000, true);
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerConnect(playerid)
{
    AutoRepairUsed[playerid] = 0;
    AutoRepairTrigger[playerid] = 0;
    SendClientMessage(playerid, 0x99FFFFAA, "Welcom To (YOUR SERVER NAME)");
    SendClientMessage(playerid, 0x99FFFFAA, "This server using Auto Repair Fs By SkulleR");
    SendClientMessage(playerid, 0x99FFFFAA, "Use /Ar or /AutoRepair To turn it on!"); ///you can edit those!
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(ar, 2, cmdtext);
	dcmd(autorepair, 10, cmdtext);
	return 0;
}

public AutoRepair()
{
	for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
	{
	    if (AutoRepairTrigger[playerid] == 1) return 1;
	    if (IsPlayerInAnyVehicle(playerid))
	    {
			if (AutoRepairUsed[playerid] == 3)
			{
				AutoRepairUsed[playerid] = 0;
			}
			new Float:CarHP;
			GetVehicleHealth(GetPlayerVehicleID(playerid), CarHP);
            if (CarHP < 1000)
            {
                new Float:X, Float:Y, Float:Z;
				RepairVehicle(GetPlayerVehicleID(playerid));
                GameTextForPlayer(playerid, "~r~Vehicle ~y~Repaired!",2000,5);
                PlayerPlaySound(playerid, 1133, X, Y, Z);
                AutoRepairUsed[playerid] = AutoRepairUsed[playerid] +1;
			}
		}
	}
	return 1;
}

public AutoFlipReset()
{
	for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
	{
	    AutoRepairUsed[playerid] = 0;
	}
	return 1;
}

dcmd_ar(playerid, params[])
{
	#pragma unused params
	if (AutoRepairTrigger[playerid] == 0)
	{
	    AutoRepairTrigger[playerid] = 1;
	    SendClientMessage(playerid, 0x99FFFFAA, "Use /Ar or /AutoRepair To Enable It Again!");
	    return 1;
	}
	else if (AutoRepairTrigger[playerid] == 1)
	{
	    AutoRepairTrigger[playerid] = 0;
	    SendClientMessage(playerid, 0x99FFFFAA, "AutoRepair Enabled");
	    return 1;
	}
	return 1;
}

dcmd_autorepair(playerid, params[])
{
	return dcmd_ar(playerid, params);
}
Credits:

SkulleR!


Dont forGet my +REP if i helped!

Download Link (PWN/AMX):
Reply
#2

Well you could make this very simple like this code --
pawn Код:
#include <a_samp>
#include <zcmd>

new bool:autofix[MAX_PLAYERS];

public OnplayerUpdate(playerid)
{
If(IsPlayerInAnyVehicle(playerid) && autofix[playerid]==true)RepairVehicle(GetPlayerVehicleID(playerid))

return 1;
}

CMD:at(playerid,params[])
{
if(autofix[playerid]==true)
{
autofix[playerid]=false;
SendClientMessage(playerid,-1,"Auto fix : {ff0000}Disabled");
}
else
{
autofix[playerid]=true;
SendClientMessage(playerid,-1,"Auto fix : {00cc00}Enabled");
}
return 1;
}
As simple as that your one is longer
Reply
#3

Easy to work, but nice enough.
Reply
#4

Simple good!
Reply
#5

Thanks Guys,
Reply
#6

Nice +rep
Reply
#7

Thanks, Eth!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)