Samp God Car Cmd Not WOrking Help!
#1

Hello Everyone i got one problem with god car when player type /godcar it fix the car but when player car damage it doesn't fix it auto. please help

PHP код:
dcmd_godcar(playerid,params[])
{
    
#pragma unused params
    
if(AccInfo[playerid][Level] >= || IsPlayerAdmin(playerid))
    {    
GetPlayerVehicleID(playerid);
        new 
vehicleid GetPlayerVehicleID(playerid);
        
SetVehicleHealth(vehicleid9999999999.0);
        
RepairVehicle(vehicleid);
        if(
IsPlayerInAnyVehicle(playerid))
        {
            if(
AccInfo[playerid][GodCar] == 0)
            {
                
AccInfo[playerid][GodCar] = 1;
                return 
SendClientMessage(playerid,white,"You have {32CD32}enabled{FFFFFF} godcar mode!");
                }
                else
                {
                
AccInfo[playerid][GodCar] = 0;
                return 
SendClientMessage(playerid,white,"You have {FF002B}disabled{FFFFFF} godcar mode!");
                }
        }
        else return 
SendClientMessage(playerid,red,"ERROR: You need to be in a car to use this command");
    } 
Reply
#2

Create a timer to check if GodCar is enabled, and then fix it if it's damage isn't a certain number or higher.
Reply
#3

HM ?
Reply
#4

this is mine. hope it works

pawn Код:
new OnPlayerUpdateExTimer[MAX_PLAYERS];
new bool:godcar[MAX_PLAYERS];

forward OnPlayerUpdateEx(playerid);

public OnPlayerConnect(playerid)
{
    OnPlayerUpdateExTimer[playerid] = SetTimerEx("OnPlayerUpdateEx", 1000, true, "i", playerid);
    godcar[playerid] = false;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(OnPlayerUpdateExTimer[playerid]);
    godcar[playerid] = false;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/godcar", cmdtext, true, 10) == 0)
    {
        if(godcar[playerid] == false)
        {
            godcar[playerid] = true;
            SendClientMessage(playerid, -1, "Activated!");
        }
        else
        if(godcar[playerid] == true)
        {
            godcar[playerid] = false;
            SendClientMessage(playerid, -1, "DeActivated!");
        }
        return 1;
    }
    return 0;
}

public OnPlayerUpdateEx(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(godcar[playerid] == true)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            SetVehicleHealth(GetPlayerVehicleID(playerid), 1000);
        }
    }
}
Reply
#5

can ya fix this warning plz (otherwise it work perfect i have test it thankx alot but please fix this warning )
warning 235: public function lacks forward declaration (symbol "OnPlayerUpdateEx")
Reply
#6

Quote:
Originally Posted by MrCripBloodz
Посмотреть сообщение
can ya fix this warning plz (otherwise it work perfect i have test it thankx alot but please fix this warning )
warning 235: public function lacks forward declaration (symbol "OnPlayerUpdateEx")
Make sure u added:
pawn Код:
forward OnPlayerUpdateEx(playerid);
Reply
#7

Thankx alot dude <333
Reply
#8

thankx alot karlos and sng
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)