SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/08/2017, 07:28 AM   #1
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 34
Reputation: 1
Default [PROBLEM] Armour and Health (MAX)

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;
}
spyro9696 is offline   Reply With Quote
Old 12/08/2017, 07:33 AM   #2
Debjit
Little Clucker
 
Join Date: Feb 2017
Posts: 14
Reputation: 2
Default Re: [PROBLEM] Armour and Health (MAX)

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


Soon to be on Hosted TAB
Debjit is offline   Reply With Quote
Old 12/08/2017, 07:35 AM   #3
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,594
Reputation: 436
Default Re: [PROBLEM] Armour and Health (MAX)

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

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

__________________

Click here to connect to Opis Gaming Roleplay
Known as Elaine Patterson on Opis-Gaming Roleplay (Server Admin)

Gamemodes || Filterscripts || Includes || Maps || Tutorials
JaKe Elite is offline   Reply With Quote
Old 12/08/2017, 07:37 AM   #4
Debjit
Little Clucker
 
Join Date: Feb 2017
Posts: 14
Reputation: 2
Default Re: [PROBLEM] Armour and Health (MAX)

Quote:
Originally Posted by JaKe Elite View Post
PHP Code:
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.
__________________


Soon to be on Hosted TAB
Debjit is offline   Reply With Quote
Old 12/08/2017, 07:44 AM   #5
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 34
Reputation: 1
Default Re: [PROBLEM] Armour and Health (MAX)

Quote:
Originally Posted by JaKe Elite View Post
PHP Code:
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
spyro9696 is offline   Reply With Quote
Old 12/08/2017, 07:51 AM   #6
Astralis
High-roller
 
Join Date: Sep 2009
Location: France
Posts: 2,899
Reputation: 364
Default Re: [PROBLEM] Armour and Health (MAX)

Remove ,params[] on each command.
__________________

Server IP: 87.98.244.35:7777 || Forum: ls-territory.com
Astralis is online now   Reply With Quote
Old 12/08/2017, 08:09 AM   #7
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 34
Reputation: 1
Default Re: [PROBLEM] Armour and Health (MAX)

Quote:
Originally Posted by Astralis View Post
Remove ,params[] on each command.
Ok, but now there are errors only in line 476
spyro9696 is offline   Reply With Quote
Old 12/08/2017, 09:06 AM   #8
GuilhermeNunes
Gangsta
 
GuilhermeNunes's Avatar
 
Join Date: Feb 2017
Location: não sei
Posts: 647
Reputation: 7
Default Re: [PROBLEM] Armour and Health (MAX)

PHP Code:
CMD:life(playerid)
{
   
SetPlayerHealth(playerid100);
   return 
1;

PHP Code:
CMD:armour(playerid)
{
  
SetPlayerArmour(playerid,100);
  return 
1;


Put in your Code
__________________
Trabalhos Criados
Code:
Nenhum.
Ser humilde,não te faz melhor do que os outros,mas te faz diferente de muitos

Last edited by GuilhermeNunes; 12/08/2017 at 10:28 AM.
GuilhermeNunes is online now   Reply With Quote
Old 12/08/2017, 09:55 AM   #9
Qbao
Little Clucker
 
Join Date: Aug 2017
Location: Vietnam
Posts: 9
Reputation: 0
Thumbs up Re: [PROBLEM] Armour and Health (MAX)

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

__________________
: P: P: P: P: : P: P P: P Learn SA-MP : P: P: P: P: P: P: P: P: P: P
Qbao is offline   Reply With Quote
Old 12/08/2017, 11:42 AM   #10
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 34
Reputation: 1
Default Re: [PROBLEM] Armour and Health (MAX)

nothing... errors, errors, errors....
spyro9696 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Health and armour problem DavidGravelli Scripting Help 2 14/06/2017 09:21 AM
Health and Armour Save Problem Kinto99 Scripting Help 6 27/03/2013 03:08 PM
Armour / Health problem Ananisiki Scripting Help 6 17/02/2013 01:43 AM
[HELP] Health and Armour for Admin PROBLEM c0GI Scripting Help 15 18/12/2011 08:43 PM
Health & Armour problem Torran Help Archive 12 23/02/2010 09:18 AM


All times are GMT. The time now is 04:34 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.