SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 12/08/2017, 08:28 AM   #1
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 35
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, 08:33 AM   #2
Debjit
Huge Clucker
 
Debjit's Avatar
 
Join Date: Feb 2017
Posts: 326
Reputation: 28
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;
}
__________________

Join Our: Forums | Discord
Release Date Announced! Read More


More the knowledge, lesser the ego. Lesser the Knowledge, more the ego.- Albert Einstein
Debjit is offline   Reply With Quote
Old 12/08/2017, 08:35 AM   #3
JaKe Elite
High-roller
 
JaKe Elite's Avatar
 
Join Date: Apr 2012
Location: Philippines
Posts: 3,631
Reputation: 444
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)
JaKe Elite is offline   Reply With Quote
Old 12/08/2017, 08:37 AM   #4
Debjit
Huge Clucker
 
Debjit's Avatar
 
Join Date: Feb 2017
Posts: 326
Reputation: 28
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.
__________________

Join Our: Forums | Discord
Release Date Announced! Read More


More the knowledge, lesser the ego. Lesser the Knowledge, more the ego.- Albert Einstein
Debjit is offline   Reply With Quote
Old 12/08/2017, 08:44 AM   #5
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 35
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, 08:51 AM   #6
Astralis
High-roller
 
Join Date: Sep 2009
Location: France
Posts: 3,109
Reputation: 400
Default Re: [PROBLEM] Armour and Health (MAX)

Remove ,params[] on each command.
__________________
http://samp4you.com
Hosted Tab 25/mo || 100 Slots 5,50/mo
Astralis is offline   Reply With Quote
Old 12/08/2017, 09:09 AM   #7
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 35
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, 10:06 AM   #8
GuilhermeNunes
Gangsta
 
Join Date: Feb 2017
Posts: 586
Reputation: 8
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

Last edited by GuilhermeNunes; 12/08/2017 at 11:28 AM.
GuilhermeNunes is offline   Reply With Quote
Old 12/08/2017, 10:55 AM   #9
Qbao
Little Clucker
 
Join Date: Aug 2017
Location: Vietnam
Posts: 24
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.");

__________________
Website Upload Image: sieutoc.tk
Qbao is offline   Reply With Quote
Old 12/08/2017, 12:42 PM   #10
spyro9696
Little Clucker
 
Join Date: Jan 2017
Posts: 35
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 10:21 AM
Health and Armour Save Problem Kinto99 Scripting Help 6 27/03/2013 04:08 PM
Armour / Health problem Ananisiki Scripting Help 6 17/02/2013 02:43 AM
[HELP] Health and Armour for Admin PROBLEM c0GI Scripting Help 15 18/12/2011 09:43 PM
Health & Armour problem Torran Help Archive 12 23/02/2010 10:18 AM


All times are GMT. The time now is 01:57 AM.


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