make a player unkillable
#1

How do i make the player who got jailed unkillable with this jail cmd? is it even possible?
Or do i need a timer who checks the players heal and heal him when loose health? If.. how?
Код:
	if(strcmp(cmd, "/Jail", true) == 0)
	{
	    if(PlayerBase[playerid][pAdmin] >= 1)
	    {
	    	tmp = strtok(cmdtext , idx);
	    	if(!strlen(tmp))
		    {
		        SCM(playerid, COLOR_GREEN, "Use: /Jail [playerid]/name] [Reason]");
		        return 1;
			}
			giveplayerid = ReturnUser(tmp);
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			while ((idx < length) && ((idx - offset) < (sizeof(tmp) - 1)))
			{
				tmp[idx - offset] = cmdtext[idx];
				idx++;
			}
			tmp[idx - offset] = EOS;
			if(!strlen(tmp))
			{
				SCM(playerid, COLOR_GREEN, "Use: /Jail [playerid/name] [Reason]]");
				return 1;
			}
			if(IsPlayerConnected(giveplayerid))
			{
			    GetPlayerName(playerid, sendare, sizeof(sendare));
			    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
   				SetPlayerPos(giveplayerid, 412.99816894531,2543.0656738281,26.244613647461);
   				ResetPlayerWeapons(giveplayerid);
				format(text, sizeof(text), "You Just Jailed %s , Reason: %s", giveplayer, tmp);
				SCM(playerid, COLOR_RED, text);
				format(text, sizeof(text), "Admin %s Jailed %s , Reason:%s", sendare, giveplayer, tmp);
				SendClientMessageToAll(COLOR_RED, text);
			}
			else{SCM(playerid, COLOR_RED, "(That player is not online!)");}
		}
		else(SCM(playerid, COLOR_RED, "You Are Not An Admin!"));
		return 1;
	}
Reply
#2

Just set his health to a high amount: 1846545 will do.
Reply
#3

also you can do if the player is jailed setplayerhealth 99999999999999
Reply
#4

Quote:
Originally Posted by akis_tze
Посмотреть сообщение
also you can do if the player is jailed setplayerhealth 99999999999999
thanks for both answers!

the player gets killen when i use 999999999. shouldnt i have +999999999 or something?
Reply
#5

Do you really use 99999999 or 99999999.0?
The Health has to be a float, maybe it shows a tag mismatch warning if you forgot the .0, then it could cause such bugs, like killing him.
Reply
#6

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Do you really use 99999999 or 99999999.0?
The Health has to be a float, maybe it shows a tag mismatch warning if you forgot the .0, then it could cause such bugs, like killing him.
ah! i didnt use "99999999.0" so now it works! thanks!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)