Need help. [Giving Rep]
#1

Can you please help me with this?
I want that if an admin type /aduty it should GetPlayerHealth and GetPlayerArmour and should SetPlayerHelath and SetPlayerArmour to 100000.
And when they type /aduty while on duty, it should set there HP to which was before they were on duty.
Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    foreach(Player, i)
		{
		    new Float:health, Float:armour;
			new string[128];
        	if(GetPVarInt(playerid, "AdminDuty") == 0)
			{
				format( string, sizeof( string ), "{AA3333}[Notice]{FFFF00}: %s (ID: %d) is now on Admin duty.", GetPlayerNameEx(i), i);
				BroadCast( COLOR_YELLOW, string);
				GetPlayerHealth(playerid, health);
				GetPlayerArmour(playerid, armour);
				SetPlayerHealth(playerid, 100000);
				SetPlayerArmour(playerid, 100000);
	            SetPVarInt(playerid, "AdminDuty", 1);
	            Admins += 1;
	        }
	        else
			{
	            format( string, sizeof( string ), "{AA3333}{Notice]{FFFF00}: %s (ID: %d) is now off Admin duty.", GetPlayerNameEx(i), i);
				BroadCast( COLOR_YELLOW, string);
				SetPlayerHealth(playerid, health);
				SetPlayerArmour(playerid, armour);
	            DeletePVar(playerid, "AdminDuty");
	            Admins -= 1;
	        }
		}
    }
    else
	{
        SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not an Administrator.");
    }
    return 1;
}
Sorry for my bad English, I hope you will understand what I want
Reply
#2

You almost got the answer add this

pawn Код:
SetPlayerHealth(playerid, health + 100000);
SetPlayerArmour(playerid, armour + 100000);
Reply
#3

Like This?

Код:
CMD:aduty(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    foreach(Player, i)
		{
		    new Float:health, Float:armour;
			new string[128];
        	if(GetPVarInt(playerid, "AdminDuty") == 0)
			{
				format( string, sizeof( string ), "{AA3333}[Notice]{FFFF00}: %s (ID: %d) is now on Admin duty.", GetPlayerNameEx(i), i);
				BroadCast( COLOR_YELLOW, string);
				GetPlayerHealth(playerid, health);
				GetPlayerArmour(playerid, armour);
				SetPlayerHealth(playerid, health + 100000);
				SetPlayerArmour(playerid, armour + 100000);
	            SetPVarInt(playerid, "AdminDuty", 1);
	            Admins += 1;
	        }
	        else
			{
	            format( string, sizeof( string ), "{AA3333}{Notice]{FFFF00}: %s (ID: %d) is now off Admin duty.", GetPlayerNameEx(i), i);
				BroadCast( COLOR_YELLOW, string);
				SetPlayerHealth(playerid, health);
				SetPlayerArmour(playerid, armour);
	            DeletePVar(playerid, "AdminDuty");
	            Admins -= 1;
	        }
		}
    }
    else
	{
        SendClientMessageEx(playerid, COLOR_GRAD1, "   You are not an Administrator.");
    }
    return 1;
}
Reply
#4

yes. and the part of where there Health and Armour Set i will prefer use SetPVarInt

pawn Код:
//add this on the top of the code where the setplayerhealth(playerid, health + 100000); is at
SetPVarInt(playerid, "MyHealth", GetPlayerHealth(playerid));
SetPVarInt(playerid, "MyArmour", GetPlayerArmour(playerid));
//then below after they off duty
SetPlayerHealth(playerid, GetPVarInt(playerid, "MyHealth"));
SetPlayerArmour(playerid, GetPVarInt(playerid, "MyArmour"));
sorry i didn't understand your english sorry about that by the way the codes are at the top
Reply
#5

No.
pawn Код:
//add this on the top of the code where the setplayerhealth(playerid, health + 100000); is at
GetPlayerHealth(playerid, SetPVarFloat(playerid,"Heal"));
GetPlayerArmour(playerid, SetPVarFloat(playerid,"Armour");
//then below after they off duty
SetPlayerHealth(playerid, GetPVarFloat(playerid, "Heal"));
SetPlayerArmour(playerid, GetPVarFloat(playerid, "Armour"));
use "PVarFloat".
Reply
#6

Writing..
Reply
#7

When I tried this..
Quote:
Originally Posted by ScriptJorkis
pawn Код:
//add this on the top of the code where the setplayerhealth(playerid, health + 100000); is at
SetPVarInt(playerid, "MyHealth", GetPlayerHealth(playerid));
SetPVarInt(playerid, "MyArmour", GetPlayerArmour(playerid));
//then below after they off duty
SetPlayerHealth(playerid, GetPVarInt(playerid, "MyHealth"));
SetPlayerArmour(playerid, GetPVarInt(playerid, "MyArmour"));
It gave me two warnings

Код:
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30654) : warning 202: number of arguments does not match definition
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30655) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
And when I tried this
Quote:
Originally Posted by sGarfield
pawn Код:
//add this on the top of the code where the setplayerhealth(playerid, health + 100000); is at
GetPlayerHealth(playerid, SetPVarFloat(playerid,"Heal"));
GetPlayerArmour(playerid, SetPVarFloat(playerid,"Armour");
//then below after they off duty
SetPlayerHealth(playerid, GetPVarFloat(playerid, "Heal"));
SetPlayerArmour(playerid, GetPVarFloat(playerid, "Armour"));
It gave me two Errors


Код:
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30654) : warning 202: number of arguments does not match definition
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30654) : error 035: argument type mismatch (argument 2)
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30655) : warning 202: number of arguments does not match definition
D:\Game\Sa-mp\Server\Current\NG-RP\gamemodes\NG-RP.pwn(30655) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#8

pawn Код:
SetPVarInt(playerid, "MyHealth", GetPlayerHealth(playerid, health));
SetPVarInt(playerid, "MyArmour", GetPlayerArmour(playerid, armour));
Reply
#9

It gives no error now but when I go on duty while I have 50 HP it set my HP to 10000 but when I go off duty it set my hp to infinite...
Anyway.. Thanks alot for the help + Reputation for you guys.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)