haw to use stock oO
#7

Actualy I think a better explaination of stock is:

If you want to do a command like checking if a player exists in a code (mysql scripting)
instead of making your code like:
pawn Код:
///command.
format(string,sizeof(string),"SELECT * FROM `table` WHERE name='%s'",randomname);
samp_mysql_query(string);
samp_mysql_store_result(); // etc etc.
You can do it in a stock so you do it like
pawn Код:
///command
if(CheckPlayerExistant(variable))
{
  //code
  //code
  //code
}
else return SendClientMessage(playerid,color,"player does not exists");
I do everything in stocks also.


---------------
Your new question:
Quote:
Originally Posted by Buttig
So for example, see:
pawn Код:
stock GivePlayerHealth(playerid, Float:health)
{
  new Float:pHealth;
  GetPlayerHealth(playerid, pHealth);
  SetPlayerHealth(playerid, pHealth + health);
}
How can you apply this command?
You can do it like
pawn Код:
if(!strcmp(cmdtext,"/givehealth",true))
  return GiveHealth(playerid,50);
Will get your current health and will add 50.
Reply


Messages In This Thread
haw to use stock oO - by user226 - 10.05.2009, 20:59
Re: haw to use stock oO - by Backwardsman97 - 10.05.2009, 21:00
Re: haw to use stock oO - by Weirdosport - 10.05.2009, 21:00
Re: haw to use stock oO - by MenaceX^ - 10.05.2009, 21:02
Re: haw to use stock oO - by Backwardsman97 - 10.05.2009, 21:04
Re: haw to use stock oO - by user226 - 10.05.2009, 21:11
Re: haw to use stock oO - by MenaceX^ - 10.05.2009, 21:12
Re: haw to use stock oO - by BeckzyBoi - 10.05.2009, 21:15
Re: haw to use stock oO - by Weirdosport - 10.05.2009, 21:21
Re: haw to use stock oO - by ferriswheel - 10.05.2009, 21:46

Forum Jump:


Users browsing this thread: 1 Guest(s)