SA-MP Forums Archive
Vip car fix - 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: Vip car fix (/showthread.php?tid=593162)



[Solved]Vip car fix - TheDarkBlade - 02.11.2015

Код:
CMD:fixveh(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
	if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][pPremiumAccount] < 1) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti premium");
		{
    		if(IsPlayerInAnyVehicle(playerid))
		    {
			    RepairVehicle(GetPlayerVehicleID(playerid));
			    Gas[GetPlayerVehicleID(playerid)] = 100;
			    SendClientMessage(playerid, COLOR_WHITE, "Masina a fost reparata.");
		    }
		}
	}
	return 1;
}
Can you add a 30 min timer please to this command, and if a player tryes to use it and the timer isn't finished he get's a meesage with the remaining time.


Re: Vip car fix - iKarim - 02.11.2015

PHP код:
// UNDER INCLUDES
#define TimeToReload 1800000 // 30 minutes.
new 
    
LastTickCount[MAX_PLAYERS];

// OnPlayerConnect: 
LastTickCount[playerid] = 0;

// YOUR COMMAND
CMD:fixveh(playeridparams[])
{
    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to login first.");
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerInfo[playerid][pPremiumAccount] < 1) return SendClientMessage(playeridCOLOR_WHITE"Nu esti premium");
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
                if(
GetTickCount() > LastTickCount[playerid])
                {
                    
RepairVehicle(GetPlayerVehicleID(playerid));
                    
Gas[GetPlayerVehicleID(playerid)] = 100;
                    
SendClientMessage(playeridCOLOR_WHITE"Masina a fost reparata.");
                    
LastTickCount[playerid] = GetTickCount() + TimeToReload;
                }
                else return 
SendClientMessage(playeridCOLOR_WHITE"Wait 30 mins before using it again.");
            }
        }
    }
    return 
1;




Re: Vip car fix - TheDarkBlade - 03.11.2015

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
PHP код:
// UNDER INCLUDES
#define TimeToReload 1800000 // 30 minutes.
new 
    
LastTickCount[MAX_PLAYERS];
// OnPlayerConnect: 
LastTickCount[playerid] = 0;
// YOUR COMMAND
CMD:fixveh(playeridparams[])
{
    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to login first.");
    if(
IsPlayerConnected(playerid))
    {
        if(
PlayerInfo[playerid][pPremiumAccount] < 1) return SendClientMessage(playeridCOLOR_WHITE"Nu esti premium");
        {
            if(
IsPlayerInAnyVehicle(playerid))
            {
                if(
GetTickCount() > LastTickCount[playerid])
                {
                    
RepairVehicle(GetPlayerVehicleID(playerid));
                    
Gas[GetPlayerVehicleID(playerid)] = 100;
                    
SendClientMessage(playeridCOLOR_WHITE"Masina a fost reparata.");
                    
LastTickCount[playerid] = GetTickCount() + TimeToReload;
                }
                else return 
SendClientMessage(playeridCOLOR_WHITE"Wait 30 mins before using it again.");
            }
        }
    }
    return 
1;

the problem is that in game it tells me that the command doesen't exist


Re: Vip car fix - TheDarkBlade - 03.11.2015

Problem Solved , please TC