SA-MP Forums Archive
... help - 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: ... help (/showthread.php?tid=589671)



... help - ahameed4755 - 21.09.2015

im using vehicle godmode but when i use the command (/vehgod) but it doesn't give me infinite health.. help


Код:
CMD:vehgod(playerid,params[])
{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"you are not rcon admin");
	if(!IsPlayerInVehicle(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"you are not in vehicle");
	SetVehicleHealth(vehicleid,playerid,99999.99);
	SendClientMessage(playerid,0xFFFFFFF,"Vehicle Godmode Activated");
	return 1;
}



Re: ... help - SecretBoss - 21.09.2015

Code seems good, did you try to do /dl command to check car's health?

Try making it with timers, for ex. each 1 sec system if player is in the car it will set its health to 1000 and then if /vehgod turned off you can kill the timer


Re: ... help - nezo2001 - 21.09.2015

PHP код:
SetVehicleHealth(vehicleid,99999.99); 



Re: ... help - SecretBoss - 21.09.2015

Код:
CMD:vehgod(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		GameTextForPlayer(playerid, "~b~~h~~h~~h~Vehicle Godmode Enabled", 5000, 3);
  		SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
  		SetTimerEx("VehGodmode", 500, true, "i", playerid);
		PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
  		return 1;
	}
	SendClientMessage(playerid, -1, "ERROR: You must be in a vehicle to repair.");
	return 1;
}

forward VehGodmode(playerid);
public VehGodmode(playerid);
{
	if(IsPlayerInAnyVehicle(playerid))
	{
  		SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
	}
	SendClientMessage(playerid, -1, "ERROR: You must be in a vehicle to repair.");
	return 1;
}



Re: ... help - ahameed4755 - 21.09.2015

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
Код:
CMD:vehgod(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		GameTextForPlayer(playerid, "~b~~h~~h~~h~Vehicle Godmode Enabled", 5000, 3);
  		SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
  		SetTimerEx("VehGodmode", 500, true, "i", playerid);
		PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
  		return 1;
	}
	SendClientMessage(playerid, -1, "ERROR: You must be in a vehicle to repair.");
	return 1;
}

forward VehGodmode(playerid);
public VehGodmode(playerid);
{
	if(IsPlayerInAnyVehicle(playerid))
	{
  		SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
	}
	SendClientMessage(playerid, -1, "ERROR: You must be in a vehicle to repair.");
	return 1;
}
will try that thanks rep+


Re: ... help - SecretBoss - 21.09.2015

Quote:
Originally Posted by ahameed4755
Посмотреть сообщение
will try that thanks rep+
Thanks btw you need to edit some things since I made very fast


Re: ... help - JaydenJason - 21.09.2015

Why would you ever use that?

Just put this piece of define above your script and set the health to the defined alias.

Код:
#if !defined INFINITY
	#define INFINITY (Float:0x7F800000)
#endif

SetVehicleHealth(vehicleid, INFINITY);