CMD:sethp(playerid, params[])
{
new bet;
if(sscanf(params, "i", bet)) return SCM(playerid, -1, "USAGE:/sethp (hp).");
new string [128];
format(string, sizeof(string), "Your Hp Has Been Setten To %i",bet);
SCM(playerid, -1, string);
SetPlayerHealth(playerid , bet);
return 1;
}
if(GetPlayerInterior(playerid) != 41) return SCM(playerid, -1, "You cannot use this command outside Four Dragons Casino"); //10 is four dragons casino id source here http://files.sa-mp.com/interiors.txt
new bet; if(sscanf(params, "i", bet)) return SCM(playerid, -1, "USAGE:/sethp (hp).");
SetPlayerHealth(playerid , bet);
|
Add this at the top
Код:
if(GetPlayerInterior(playerid) != 41) return SCM(playerid, -1, "You cannot use this command outside Four Dragons Casino"); //10 is four dragons casino id source here http://files.sa-mp.com/interiors.txt |
|
What's the point of this code, bet ?
Much of copy/paste. Код:
new bet; if(sscanf(params, "i", bet)) return SCM(playerid, -1, "USAGE:/sethp (hp)."); Код:
SetPlayerHealth(playerid , bet); |
i Give This Example instead of my original code|
Add this at the top
Код:
if(GetPlayerInterior(playerid) != 41) return SCM(playerid, -1, "You cannot use this command outside Four Dragons Casino"); //10 is four dragons casino id source here http://files.sa-mp.com/interiors.txt |
CMD:sethp(playerid, params[])
{
new Float:bet;
if(sscanf(params, "f", bet)) return SCM(playerid, -1, "USAGE:/sethp (hp).");
new string [128];
format(string, sizeof(string), "Your Hp Has Been Setten To %.2f",bet);
SCM(playerid, -1, string);
SetPlayerHealth(playerid , bet);
return 1;
}
|
By the way, health is a Float. So your code should looks like:
PHP код:
|

CMD:sethp(playerid, params[])
{
new Float:bet, string[92];
if(!IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z))
return SCM(playerid, -1, "* You are not inside Four Dragons casino.");
if(sscanf(params, "f", bet))
return SCM(playerid, -1, "USAGE:/sethp (hp).");
format(string, sizeof(string), "Your Hp Has Been Setten To %.2f",bet);
SCM(playerid, -1, string);
SetPlayerHealth(playerid , bet);
return 1;
}
|
Get a coordinate inside Four Dragons and use /save.
Gather the saved coordinates from your My Documents > GTA SA User Files > SAMP > savedpositions.txt The next thing that you wanna do is copy paste the x, y, z coordinates and copy paste them on IsPlayerInRangeOfPoint and then check if they are in the range, if they are let /sethp execute otherwise if not then print out a client message to the player that they aren't in Four Dragons casino. So basically it would've looked like this PHP код:
|