vehicle god mode
#1

hey guys i tried to script a vehicle god mode , it compiles but it doesnt work
anyone knows how to fix that?

Код:
//on top of the script
new vgod[MAX_PLAYERS];

//OnPlayerConnect

    vgod[playerid] = 1;

//OnPlayerDisconnect

    vgod[playerid] = 0;

//command

	CMD:vgod(playerid, params[])
	{
		if(vgod[playerid] == 0)
		{
		    GameTextForPlayer(playerid, "VEHICLE GOD ~r~enabled", 3000, 5);
			vgod[playerid] = 1;
		}
		if(vgod[playerid] == 1)
		{
		    GameTextForPlayer(playerid, "VEHICLE GOD ~r~disabled", 3000, 5);
		    vgod[playerid] = 0;
		}
		return 1;
	}

//OnPlayerEnterVehicle

	if(vgod[playerid] == 0)
	{
	    return 1;
	}
	if(vgod[playerid] == 1)
	{
	    SetVehicleHealth(playerid, 10000);
	}
Reply
#2

You're passing the player ID to the function. You need to pass the player's VEHICLE ID. GetPlayerVehicleID().
Reply
#3

holy shit im really stupid xD
thanks gonna test it
Reply
#4

still the same problem
when i type /vgod anytime , it shows me "Veh god disabled" (it never enables) (
Reply
#5

Код:
vgod[playerid] = 0;
Put this OnPlayerConnect.
Reply
#6

tried that but nothing changed
Reply
#7

Код:
//OnPlayerEnterVehicle

	if(vgod[playerid] == 0)
	{
	    return 1;
	}
	if(vgod[playerid] == 1)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
	    SetVehicleHealth(vehicleid, 1000.0);
	}
Try it now.
Reply
#8

did that but it didn't work also :/
Reply
#9

If you are in a vehicle while entering the command then it won't work until you re-enter your vehicle. Your command merely sets a variable. It doesn't set the health.
Reply
#10

oh, how to fix it then?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)