SA-MP Forums Archive
/heal help - 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: /heal help (/showthread.php?tid=300005)



/heal help - boyan96 - 28.11.2011

can someone make me the command to setplayer hp and armor to 100 and each player to can use it 1 time in 2 minutes


Re: /heal help - SmiT - 28.11.2011

pawn Код:
new
    HealUsed[ MAX_PLAYERS ]
;


forward @RefreshCmd( playerid );

@RefreshCmd( playerid )
{
    HealUsed[ playerid ] = 0;
    SendClientMessage( playerid, -1, #two minutes passed you can now use heal command );
}

CMD:heal( playerid, params[] )
{  
    if ( HealUsed[ playerid ] == 1 ) return SendClientMessage( playerid, -1, #you cannot use this command, 2 minutes not passed );
    SetPlayerHealth( playerid, 100 );
    SetPlayerArmour( playerid, 100 );
    HealUsed[ playerid ] = 1;
    SetTimerEx( "RefreshCmd", 120000, false, "i", playerid );
   
    return ( 1 );
}



Re: /heal help - boyan96 - 28.11.2011

can we make it more easy


Re: /heal help - MP2 - 28.11.2011

What command system are you using? I use dcmd so...

pawn Код:
new pHealTime[MAX_PLAYERS];

dcmd_heal(playerid, params[])
{
    #pragma unused params
    if(gettime()-pHealTime[playerid] < 120) return SendClientMessage(playerid, COLOR_RED, "You can only heal once every 2 minutes.");
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    pHealTime[playerid] = gettime();
    return 1;
}
Not tested.


Re: /heal help - tyler12 - 28.11.2011

Код:
if(strcmp, "/heal", cmd, true, 10) == 0)
    {
         SetPlayerHealth(playerid, 100); // You can also edit the health healing here
         SetPlayerArmour(playerid, 100);//You can also edit the armour healing here
         SendClientMessage(playerid, [COLORHERE], "You have healed yourself.");
         return 1;
not tested


Re: /heal help - MP2 - 28.11.2011

Try reading the thread first.
Quote:
Originally Posted by boyan96
Посмотреть сообщение
can someone make me the command to setplayer hp and armor to 100 and each player to can use it 1 time in 2 minutes