God car?
#1

Here is my script but its not working.

pawn Код:
if (strcmp("/godc", cmdtext, true, 8 ) == 0)
{
    if(GetPVarInt(playerid,"GodCar")==0)
    {
        SetVehicleHealth(playerid,1000000);
        SetPVarInt(playerid,"GodCar",1);
        SendClientMessage(playerid,COL_ADMIN,"God car on");
    }
    else
    {
        SetVehicleHealth(playerid,1000);
        SetPVarInt(playerid,"GodCar",0);
        SendClientMessage(playerid,COL_ADMIN,"God car off");
       
    }
    return 1;
}
Reply
#2

That just sets the vehicle health.. use this:

Код:
//Global variable:
new GodCar[MAX_PLAYERS];
//Command:
if (strcmp("/godc", cmdtext, true, 8 ) == 0)
{
    if(GetPVarInt(playerid,"GodCar")==0)
    {
        GodCar[playerid] = SetTimerEx("GodCar",500,true,"d",playerid);
        SetPVarInt(playerid,"GodCar",1);
        SendClientMessage(playerid,COL_ADMIN,"God car on");
    }
    else
    {
        KillTimer(GodCar[playerid]);
        SetPVarInt(playerid,"GodCar",0);
        SendClientMessage(playerid,COL_ADMIN,"God car off");
       
    }
    return 1;
}
//TIMER:
forward GodCar(playerid);
public GodCar(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
RepairVehicle(GetPlayerVehicleID(playerid));
}
return 1;
}
Reply
#3

pawn Код:
(282) : error 029: invalid expression, assumed zero
(282) : error 012: invalid function call, not a valid address
(282) : warning 215: expression has no effect
(282) : error 001: expected token: ";", but found ")"
(282) : fatal error 107: too many error messages on one line
pawn Код:
forward GodCar(playerid);
Reply
#4

Add
Код:
new GodCar[MAX_PLAYERS];
to the top of the script..
Reply
#5

i did but i got those errors after i did. I changed the errors to new ones
Reply
#6

Try changing
pawn Код:
RepairVehicle(GetPlayerVehicleID(playerid));
to

pawn Код:
RepairVehicle(vehicleid);
Reply
#7

still the same. Where should i add the timer under? i have it right under the /godc command but i dont believe thats right
Reply
#8

Quote:
Originally Posted by googamalugafoo
Посмотреть сообщение
still the same. Where should i add the timer under? i have it right under the /godc command but i dont believe thats right
It should be at the very bottom of your script.
Reply
#9

No matter where i put it i keep getting an error with
pawn Код:
forward GodCar(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)