SA-MP Forums Archive
vehicle god mode - 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: vehicle god mode (/showthread.php?tid=420484)



vehicle god mode - absolute - 05.03.2013

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);
	}



Re: vehicle god mode - MP2 - 05.03.2013

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


Re: vehicle god mode - absolute - 05.03.2013

holy shit im really stupid xD
thanks gonna test it


Re: vehicle god mode - absolute - 05.03.2013

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


Re: vehicle god mode - Vegas. - 05.03.2013

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


Re: vehicle god mode - absolute - 05.03.2013

tried that but nothing changed


Re: vehicle god mode - Vegas. - 05.03.2013

Код:
//OnPlayerEnterVehicle

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


Re: vehicle god mode - absolute - 05.03.2013

did that but it didn't work also :/


Re: vehicle god mode - Vince - 05.03.2013

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.


Re: vehicle god mode - absolute - 05.03.2013

oh, how to fix it then?