SA-MP Forums Archive
Unlimited Vehicle's Health and turning off nick. - 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: Unlimited Vehicle's Health and turning off nick. (/showthread.php?tid=580176)



Unlimited Vehicle's Health and turning off nick. - WaJeeH - 03.07.2015

Hey Guyz.I need help.
I have /adminduty command and i want to add that,When a play with admin duty on sits in any vehicle,his car's health should be unlimited i mean ( It should be GODCAR ) and secondly,When he turns on /adminduty,His nick BAR should be removed.Here is the command:
PHP код:
COMMAND:adminduty(playeridparams[])
{
    if(
PlayerInfo[playerid][pSpawned] == 1)
    {
    if(
PlayerInfo[playerid][pAdminlevel] > 0)
    {
    if(
AdminDuty[playerid] == 1)
    {
    
SetPlayerSkin(playerid,OldSkin[playerid]);
    
SendClientMessage(playerid,COLOR_ADMIN,"ADMIN Action: Admin Duty Is Now OFF.");
    
SetPlayerHealth(playerid100);
    
SetPlayerArmour(playerid100);
    
SetPlayerColor(playeridCOLOR_WHITE);
    
GivePlayerCommonWeapons(playerid);
    
AdminDuty[playerid] = 0;
    }else{
    
OldSkin[playerid] = GetPlayerSkin(playerid);
    
SendClientMessage(playerid,COLOR_ADMIN,"ADMIN Action: Admin Duty Is Now ON.");
    
SetPlayerHealth(playerid,1000000);
       
SetPlayerArmour(playerid,1000000);
       
SetPlayerWantedLevel(playerid0);
     
GivePlayerWeapon(playerid,16,100000);
     
GivePlayerWeapon(playerid,44,100000);
     
GivePlayerWeapon(playerid,41,100000);
    
GivePlayerWeapon(playerid,24,100000);
    
GivePlayerWeapon(playerid,26,100000);
    
GivePlayerWeapon(playerid,38,100000);
    
GivePlayerWeapon(playerid,18,100000);
    
GivePlayerWeapon(playerid,28,100000);
    
GivePlayerWeapon(playerid,43,100000);
    
GivePlayerWeapon(playerid,34,100000);
    
GivePlayerWeapon(playerid,31,100000);
    
AdminDuty[playerid] = 1;
    }
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
    }
    }else{
    
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Use This Command WHile You're Dead.");
    }
    return 
1;




Re: Unlimited Vehicle's Health and turning off nick. - Prokill911 - 03.07.2015

PHP код:
#define INFINITY_HP (Float:0x7F800000) 
Put that at the top of your script

An then use

PHP код:
SetPlayerHealth(playerid,INFINITY_HP); 
SetPlayerArmour(playerid,INFINITY_HP); 
Then for the vehicle do the same.
When they enter a vehicle, Get the vehicle ID - Set it to INFINITY_HP..
When they exit.. Set it too 1000.0

done...

The reason it's probably not working for you at the moment is because the max player health is like 1000..
After that it resets back to 100.. an so on if not 0


Re: Unlimited Vehicle's Health and turning off nick. - WaJeeH - 03.07.2015

I have already set Player's HP to Infinity but,I just need for Vehicle's HP so Copy that CODE and please PM me or paste it here.
Secondly,I also want to remove the nick bar from play on /adminduty....


Re: Unlimited Vehicle's Health and turning off nick. - JaydenJason - 03.07.2015

SetVehicleHealth(<insert vehicleid here>, INFINITY_HP);



and for the names, use this at the command:

Код:
foreach (Player, i)
{
		if(IsPlayerConnected(i))
		{
			ShowPlayerNameTagForPlayer(i, playerid, 0);
		}
}
and under OnPlayerStreamIn:
Код:
if(adminduty[playerid(or something)] == 1) ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);



Re: Unlimited Vehicle's Health and turning off nick. - WaJeeH - 03.07.2015

Quote:

SetVehicleHealth(<insert vehicleid here>, INFINITY_HP);

I want for all vehicles....and i have to add this in the command?


Re: Unlimited Vehicle's Health and turning off nick. - JaydenJason - 03.07.2015

Код:
COMMAND:adminduty(playerid, params[])
{
	if(PlayerInfo[playerid][pSpawned] == 1)
	{
		if(PlayerInfo[playerid][pAdminlevel] > 0)
		{
			if(AdminDuty[playerid] == 1)
			{
				SetPlayerSkin(playerid,OldSkin[playerid]);
				
				SendClientMessage(playerid,COLOR_ADMIN,"ADMIN Action: Admin Duty Is Now OFF.");
				
				SetPlayerHealth(playerid, 100);
				SetPlayerArmour(playerid, 100);
				SetPlayerColor(playerid, COLOR_WHITE);
				
				GivePlayerCommonWeapons(playerid);
				AdminDuty[playerid] = 0;
			}
			else
			{
				OldSkin[playerid] = GetPlayerSkin(playerid);
				
				foreach (Player, i)
				{
					if(IsPlayerConnected(i))
					{
						ShowPlayerNameTagForPlayer(i, playerid, 0);
					}
				}
				
				SendClientMessage(playerid,COLOR_ADMIN,"ADMIN Action: Admin Duty Is Now ON.");
				
				SetPlayerHealth(playerid,INFINITY_HP);
				SetPlayerArmour(playerid,INFINITY_HP);
				
				if(GetPlayerVehicleID(playerid) > 0) SetVehicleHealth(GetPlayerVehicleID(playerid), INFINITY_HP);
				
				SetPlayerWantedLevel(playerid, 0);
				GivePlayerWeapon(playerid,16,100000);
				GivePlayerWeapon(playerid,44,100000);
				GivePlayerWeapon(playerid,41,100000);
				GivePlayerWeapon(playerid,24,100000);
				GivePlayerWeapon(playerid,26,100000);
				GivePlayerWeapon(playerid,38,100000);
				GivePlayerWeapon(playerid,18,100000);
				GivePlayerWeapon(playerid,28,100000);
				GivePlayerWeapon(playerid,43,100000);
				GivePlayerWeapon(playerid,34,100000);
				GivePlayerWeapon(playerid,31,100000);
				
				AdminDuty[playerid] = 1;
			}
		}
		else
		{
			SendClientMessage(playerid,COLOR_ERROR,""ERROR_MSG"");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_ERROR, "You can't use this command while you're dead.");
	}
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	if(AdminDuty[playerid] == 1) ShowPlayerNameTagForPlayer(forplayerid, playerid, 0);
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) SetVehicleHealth(GetPlayerVehicleID(playerid), 999.0);
	if(newstate == PLAYER_STATE_DRIVER) SetVehicleHealth(GetPlayerVehicleID(playerid), INFINITY_HP);
	return 1;
}



Re: Unlimited Vehicle's Health and turning off nick. - WaJeeH - 04.07.2015

Thank you dude.


Re: Unlimited Vehicle's Health and turning off nick. - WaJeeH - 04.07.2015

See this :
Quote:

C:\Users\IT SYSTEMS\Desktop\AWD SAMP\gamemodes\DEATHMATCH.pwn(20411) : error 021: symbol already defined: "S@@_OnPlayerStateChange"
C:\Users\IT SYSTEMS\Desktop\AWD SAMP\gamemodes\DEATHMATCH.pwn(20920) : error 021: symbol already defined: "S@@_OnPlayerStreamIn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.