/godcar, and /godcaroff help
#1

pawn Code:
forward AutoR(playerid);
public AutoR(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        new vid = GetPlayerVehicleID(playerid);
        RepairVehicle(vid);
    }
    return 1;
}
pawn Code:
new timer1;
COMMAND:godcar(playerid, cmdtext)
{
    timer1 = SetTimer("AutoR", 1000, true);
    return 1;
}
COMMAND:godcaroff(playerid, cmdtext)
{
    KillTimer(timer1);
    return 1;
}
How to fix this, this is really, really, really, bugged O.o Please help <3
Reply
#2

Try this code.
pawn Code:
new timer1[MAX_PLAYERS];
COMMAND:godcar(playerid, cmdtext)
{
    timer1[playerid] = SetTimerEx("AutoR", 1000, true,"d",playerid);
    return 1;
}

COMMAND:godcaroff(playerid, cmdtext)
{
    KillTimer(timer1[playerid]);
    return 1;
}
Reply
#3

Since MidoTrick's script code is messed up by 3 things, I made a re-make of his script.
Credit's goes to him.

pawn Code:
///Somewhere on top of your script
new bool:HasVehicleGodmode[MAX_PLAYERS];


//Under OnGameModeInit
SetTimer("Actualize", 2000, true);


//Under your Command Godmode (ON)
HasVehicleGodmode[playerid] = true;

//Under your Command Godmode (OFF)
HasVehicleGodmode[playerid] = false;


//Somewhere between all the Callbacks (public's)
forward AutoR(playerid);
public AutoR(playerid)
{
    if(IsPlayerInAnyVehicle(playerid) && HasVehicleGodmode[playerid])
    {
        new vid = GetPlayerVehicleID(playerid);
        RepairVehicle(vid);
    }
    return 1;
}
Reply
#4

Only one person on the server can use the godcar command now, why's this?

EDIT:Your version didn't work at all O.o
Reply
#5

pawn Code:
new GodMode[MAX_PLAYERS];
//Under OnGameModeInit
SetTimer("AutoR", 2000, true);

//Under your Command Godmode (ON)
GodMode[playerid] = 1;

//Under your Command Godmode (OFF)
GodMode[playerid] = 0;

forward AutoR(playerid);
public AutoR(playerid)
{
    if(IsPlayerInAnyVehicle(playerid) && GodMode[playerid] == 1)
    {
        new vid = GetPlayerVehicleID(playerid);
        RepairVehicle(vid);
    }
    return 1;
}
And also you can make public like this
pawn Code:
public AutoR(playerid)
{
    if(IsPlayerInAnyVehicle(playerid) && GodMode[playerid] == 1)
    {
        new vid = GetPlayerVehicleID(playerid);
        new Float:health;
        GetVehicleHealth(vid, health);
        if(health <999) // or lower....
        {
            RepairVehicle(vid);
        }  
    }
}
Reply
#6

pawn Code:
//Somewhere on top of your script
new bool:VehicleGodmode[MAX_PLAYERS];

//Somewhere between all the Callbacks (public's)
COMMAND:godcar(playerid, cmdtext)
{
    if(!VehicleGodmode) VehicleGodmode = true;
    if(VehicleGodmode) VehicleGodmode = false;
}

//under "OnPlayerUpdate(playerid)" Callback (public)
if(VehicleGodmode) return RepairVehicle(GetPlayerVehicleID(playerid));
This should completly work.
Reply
#7

PHP Code:
CMD:godcar(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You are not an Admin");
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        
SetVehicleHealth(vehicleid9999999999.0);
    }
    return 
1;

PHP Code:
CMD:godcaroff(playeridparams[])
{
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You are not an Admin");
    {
        new 
vehicleid GetPlayerVehicleID(playerid);
        
SetVehicleHealth(vehicleid1000.0);
    }
    return 
1;

I Didn't know what did you really want, but these are working when you use /godcar and /godcaroff, And you don't need a useless timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)