PDA

View Full Version : if(GetPlayerHealth


[Cali]ChrOnic_T
07/06/2014, 10:04 AM
How to make this say. "You need 100 HP to teleport here"



CMD:ls(playerid,params[])
{
if(hamburger12[playerid] == 1)
return SendClientMessage(playerid,0xE6421AC8, "Please wait before teleporting again");
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "{6F8091} {2B5ED5}%s {FFFFFF}has went to{58E11E} Los Santos! {FFFFFF}(/ls)", pname);
SendClientMessageToAll(0xE3211CFF, string);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1943.1512,-2123.6318,13.5538);
SetPlayerFacingAngle(playerid,272.8049);
hamburger12[playerid] = 1;
hamburger13[playerid]= SetTimerEx("Teleport", 6000, false, "d", playerid);
SetPlayerVirtualWorld(playerid,0);
SetPlayerArmour(playerid,0);
return 1;
}

NaClchemistryK
07/06/2014, 10:06 AM
-delete-

Parallex
07/06/2014, 10:07 AM
CMD:ls(playerid,params[])
{
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 100.0) return SendClientMessage(playerid,0xE6421AC8,"You need atleast 100 health to teleport here.");
if(hamburger12[playerid] == 1)
return SendClientMessage(playerid,0xE6421AC8, "Please wait before teleporting again");
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "{6F8091} {2B5ED5}%s {FFFFFF}has went to{58E11E} Los Santos! {FFFFFF}(/ls)", pname);
SendClientMessageToAll(0xE3211CFF, string);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1943.1512,-2123.6318,13.5538);
SetPlayerFacingAngle(playerid,272.8049);
hamburger12[playerid] = 1;
hamburger13[playerid]= SetTimerEx("Teleport", 6000, false, "d", playerid);
SetPlayerVirtualWorld(playerid,0);
SetPlayerArmour(playerid,0);
return 1;
}

Kirollos
07/06/2014, 10:10 AM
if(GetPlayerHealth(playerid) < 100) return SendClientMessage)playerid,-1,"must have 100 hp at least");


GetPlayerHealth doesn't return player's health, hence parameter "Float:health" exists..

http://wiki.sa-mp.com/wiki/GetPlayerHealth

NaClchemistryK
07/06/2014, 10:12 AM
yeah yeah, I realized that getplayerhealth has a second parameter which needs a float, so I requested a delete when I saw the post below which was correct