SA-MP Forums Archive
/sethp CMD +REP - 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: /sethp CMD +REP (/showthread.php?tid=647362)



/sethp CMD +REP - Osamakurdi - 04.01.2018

I Have This Command :

Код:
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;

}
How I Can Do It Can Used Only In Four Dragons Casino?


Re: /sethp CMD +REP - FailerZ - 04.01.2018

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
EDIT: double check the interoir id i guess i got the wrong source (41 ml)


Re: /sethp CMD +REP - Bolex_ - 04.01.2018

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);



Re: /sethp CMD +REP - Osamakurdi - 04.01.2018

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
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
EDIT: double check the interoir id i guess i got the wrong source (41 ml)
Thanks + REP


Re: /sethp CMD +REP - Osamakurdi - 04.01.2018

Quote:
Originally Posted by Bolex_
Посмотреть сообщение
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 Know i Give This Example instead of my original code
cuz my code is about 60-70 sentences


Re: /sethp CMD +REP - Osamakurdi - 04.01.2018

Quote:
Originally Posted by FailerZ
Посмотреть сообщение
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
EDIT: double check the interoir id i guess i got the wrong source (41 ml)
First: I Reached Limit in This 24 h But I'll Give You Later.
Sec:its 10 , 10 works but 41 not works


Re: /sethp CMD +REP - Dayrion - 04.01.2018

By the way, health is a Float. So your code should looks like:
PHP код:
CMD:sethp(playeridparams[])
{
    new 
Float:bet;
    if(
sscanf(params"f"bet)) return SCM(playerid, -1"USAGE:/sethp (hp).");
    new 
string [128];
    
format(stringsizeof(string), "Your Hp Has Been Setten To %.2f",bet);
    
SCM(playerid, -1string);
    
SetPlayerHealth(playerid bet);
    return 
1;




Re: /sethp CMD +REP - Osamakurdi - 04.01.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
By the way, health is a Float. So your code should looks like:
PHP код:
CMD:sethp(playeridparams[])
{
    new 
Float:bet;
    if(
sscanf(params"f"bet)) return SCM(playerid, -1"USAGE:/sethp (hp).");
    new 
string [128];
    
format(stringsizeof(string), "Your Hp Has Been Setten To %.2f",bet);
    
SCM(playerid, -1string);
    
SetPlayerHealth(playerid bet);
    return 
1;

ik i just give an example fast ...
see what i replied to him...


Re: /sethp CMD +REP - JaKe Elite - 04.01.2018

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 код:
CMD:sethp(playeridparams[]) 

    new 
Float:betstring[92]; 
    
    if(!
IsPlayerInRangeOfPoint(playeridFloat:rangeFloat:xFloat:yFloat: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(stringsizeof(string), "Your Hp Has Been Setten To %.2f",bet); 
    
SCM(playerid, -1string); 
    
SetPlayerHealth(playerid bet); 
    return 
1

Replace the range with the amount of radius do you want the player near in the coords in order to execute the command and replace the X Y Z with the coordinates that you've gathered


Re: /sethp CMD +REP - Osamakurdi - 04.01.2018

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
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 код:
CMD:sethp(playeridparams[]) 

    new 
Float:betstring[92]; 
    
    if(!
IsPlayerInRangeOfPoint(playeridFloat:rangeFloat:xFloat:yFloat: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(stringsizeof(string), "Your Hp Has Been Setten To %.2f",bet); 
    
SCM(playerid, -1string); 
    
SetPlayerHealth(playerid bet); 
    return 
1

Replace the range with the amount of radius do you want the player near in the coords in order to execute the command and replace the X Y Z with the coordinates that you've gathered
Thanks !