SA-MP Forums Archive
[PROBLEM] Armour and Health (MAX) - 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: [PROBLEM] Armour and Health (MAX) (/showthread.php?tid=639142)



[PROBLEM] Armour and Health (MAX) - spyro9696 - 12.08.2017

Hello, I have another problem... I don't know how to set directly to the maximum health and armour.
When I type /health and /armour, it don't set me the max health and armour, but it requires a number.
Ex: /health 100
So, is it possible set your health and armour directly to the maximum typing /health and /armour?

This is the code:

Quote:

COMMAND:armour(playerid, params[])
{
new id;
if (sscanf(params, "i", id))
return SendClientMessage(playerid, 0xFF0000AA, "Usage: /armour <armour>");
SetPlayerArmour(playerid, id);
// Do something
return 1;
}

COMMAND:health(playerid, params[])
{
new id;
if (sscanf(params, "i", id))
return SendClientMessage(playerid, 0xFF0000AA, "Usage: /health <health>");
SetPlayerHealth(playerid, id);
// Do something
return 1;
}




Re: [PROBLEM] Armour and Health (MAX) - Zeth - 12.08.2017

Yes it is possible.
Check this out:
Quote:

COMMAND:armour(playerid, params[])
{
//new id;
//if (sscanf(params, "i", id))
//return SendClientMessage(playerid, 0xFF0000AA, "Usage: /armour <armour>");
SetPlayerArmour(playerid, 100);
// Do something
return 1;
}

COMMAND:health(playerid, params[])
{
//new id;
//if (sscanf(params, "i", id))
//return SendClientMessage(playerid, 0xFF0000AA, "Usage: /health <health>");
SetPlayerHealth(playerid, 100);
// Do something
return 1;
}




Re: [PROBLEM] Armour and Health (MAX) - JaKe Elite - 12.08.2017

PHP код:
COMMAND:armour(playeridparams[])
{
    
SetPlayerArmour(playerid100);
    
SendClientMessage(playerid, -1"Armour refilled.");
    return 
1;
}

COMMAND:health(playeridparams[])
{
    
SetPlayerHealth(playerid100);
    
SendClientMessage(playerid, -1"Health refilled.");
    return 
1;




Re: [PROBLEM] Armour and Health (MAX) - Zeth - 12.08.2017

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
PHP код:
COMMAND:armour(playeridparams[])
{
    
SetPlayerArmour(playerid100);
    
SendClientMessage(playerid, -1"Armour refilled.");
    return 
1;
}
COMMAND:health(playeridparams[])
{
    
SetPlayerHealth(playerid100);
    
SendClientMessage(playerid, -1"Health refilled.");
    return 
1;

That is what i said above.


Re: [PROBLEM] Armour and Health (MAX) - spyro9696 - 12.08.2017

Quote:
Originally Posted by JaKe Elite
Посмотреть сообщение
PHP код:
COMMAND:armour(playeridparams[])
{
    
SetPlayerArmour(playerid100);
    
SendClientMessage(playerid, -1"Armour refilled.");
    return 
1;
}
COMMAND:health(playeridparams[])
{
    
SetPlayerHealth(playerid100);
    
SendClientMessage(playerid, -1"Health refilled.");
    return 
1;

Jake, when I compile, it gives me these errors



Re: [PROBLEM] Armour and Health (MAX) - Astralis - 12.08.2017

Remove ,params[] on each command.


Re: [PROBLEM] Armour and Health (MAX) - spyro9696 - 12.08.2017

Quote:
Originally Posted by Astralis
Посмотреть сообщение
Remove ,params[] on each command.
Ok, but now there are errors only in line 476



Re: [PROBLEM] Armour and Health (MAX) - GuilhermeNunes - 12.08.2017

PHP код:
CMD:life(playerid)
{
   
SetPlayerHealth(playerid100);
   return 
1;

PHP код:
CMD:armour(playerid)
{
  
SetPlayerArmour(playerid,100);
  return 
1;

Put in your Code


Re: [PROBLEM] Armour and Health (MAX) - Qbao - 12.08.2017

Did you try this command?
PHP код:
COMMAND:armour(playeridparams[])
{
   
SetPlayerArmor(playerid100);
   
SendClientMessageEx(playerid0x00FF00"Armour refilled.");
}
//
COMMAND:health(playeridparams[])
{
   
SetPlayerHealth(playerid100);
   
SendClientMessageEx(playerid0x00FF00"Health refilled.");




Re: [PROBLEM] Armour and Health (MAX) - spyro9696 - 12.08.2017

nothing... errors, errors, errors....