SA-MP Forums Archive
Car Repair With Timer. - 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: Car Repair With Timer. (/showthread.php?tid=625825)



Car Repair With Timer. - aymane123 - 06.01.2017

I am Trying to make a vip cmd /vfix to fix cars i found this https://sampwiki.blast.hk/wiki/RepairVehicle But i cant attach it with timer and vip system so any help ?
Anyway here is an example of the vip system:
Код:
CMD:weapon(playerid, params[]) {
    if(Player[playerid][vipLevel] < 1) return SendClientMessage(playerid, 0xF8F8F8FFF,"[ERROR]: You need to be Standard VIP at-least to use this CMD.");
    GivePlayerWeapon(playerid, 24, 500);
    return 1;
}



Re: Car Repair With Timer. - RedRex - 06.01.2017

Here you go:

Код:
if(strcmp(cmd, "/vfix", true) == 0)
{
if(IsPlayerVipType(playerid,2))
{
SetVehicleHealth(vehicleid, 1000);
}
else SendClientMessage(playerid, COLOR_WHITE, "ERROR: You not is a Silver or Gold Member!");
return 1;
}



Re: Car Repair With Timer. - ISmokezU - 06.01.2017

Delete...


Re: Car Repair With Timer. - aymane123 - 06.01.2017

Sorry but i am using vipLevel not IsPlayerVipType and i am using zcmd too anyway Thanks for Your reply.


Respuesta: Car Repair With Timer. - Whillyrez - 06.01.2017

lol, isn't hard to change that with your variables...
PHP код:
CMD:vfix(playeridparams[])
{
    if(
Player[playerid][vipLevel] != 0)
    {
        
SetVehicleHealth(vehicleid1000);
    }
    else 
SendClientMessage(playerid0xF8F8F8FFF,"[ERROR]: You need to be Standard VIP at-least to use this CMD.");
    return 
1;

Or, easier...
PHP код:
CMD:vfix(playeridparams[])
{
    if(
Player[playerid][vipLevel] < 1) return SendClientMessage(playerid0xF8F8F8FFF,"[ERROR]: You need to be Standard VIP at-least to use this CMD.");
    
SetVehicleHealth(vehicleid1000);
    return 
1;




Re: Car Repair With Timer. - aymane123 - 06.01.2017

i made this but i got vehicleid not defined.
PHP код:
CMD:vfix(playeridparams[])
{
    if(
Player[playerid][vipLevel] < 1) return SendClientMessage(playerid0xF8F8F8FFF,"[ERROR]: You need to be Standard VIP at-least to use this CMD.");
    
SetVehicleHealth(vehicleid1000);
    return 
1;




Re: Car Repair With Timer. - Lordzy - 06.01.2017

You must check if player is in any vehicle first.
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
    SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
You can have a global timer to loop through the players who have vip fix enabled. I'd suggest using a custom array list containing the ids of those who enabled or by using foreach.
https://sampwiki.blast.hk/wiki/SetTimer