Armour Regeneration Scripting Help
#1

Hi All,

Armour Regeneration This Very Simple
Im Use ZCMD To Create This Armour Regeneration

Код:
CMD:hm(playerid,params[]){

if(GetPlayerPos(playerid),X,Y,Z)
return SendClientMessage(playerid,-1,"You are not in the position to get Armour Regeneration!");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
return 1;
}
Reply
#2

GetPlayerPos will return player position. you have to use IsPlayerInRangeOfPoint function to check if player is in range of a position or no.
See wiki
Reply
#3

This is not the right way. You can't use GetPlayerPos in if as it returns only success and failures.

Fixed code is:
PHP код:
CMD:hm(playerid,params[]){
    if(!
IsPlayerInRangeOfPoint(................blah....blah....)) return SendClientMessage(playerid,-1,"You are not in the position to get Armour Regeneration!");
    
SetPlayerHealth(playerid,100);
    
SetPlayerArmour(playerid,100);
    return 
1;

IsPlayerInRangeOfPoint: https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint
Reply
#4

pawn Код:
CMD:hm(playerid,params[])
{
    if(!IsPlayerInRangeOfPoint(playerid,10.0,0.00,0.00,0.00)) return SendClientMessage(playerid,-1,"You are not in the position to get Armour Regeneration!");
    else
    {
        SetPlayerHealth(playerid,100);
        SetPlayerArmour(playerid,100);
    }
    return 1;
}
replace 10.0 with the distance from your point, and the 0.00(s) to where you want the Command to be used at (aka your point).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)