[PROBLEM] Armour and Health (MAX)
#1

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

Reply
#2

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

Reply
#3

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;

Reply
#4

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.
Reply
#5

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
Reply
#6

Remove ,params[] on each command.
Reply
#7

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

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

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

Put in your Code
Reply
#9

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

Reply
#10

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


Forum Jump:


Users browsing this thread: 4 Guest(s)