Stock Variable? - 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: Stock Variable? (
/showthread.php?tid=301417)
Stock Variable? -
Admigo - 04.12.2011
Heey all,
How can i make a stock thats detect if variable is 1 or 0 and changes a text?
Explain:
Код:
new clothes1[MAX_PLAYERS]=0;//clothes id 1
stock hasclothes1(variable)//detects variable id 0 or 1??
{
static variable;
switch(clothes1)
{
case 0: strcat(variable, "has no clothes1");//if clothes1[playerid]=0 then the text is has no clothes
case 1: strcat(variable, "has clothes1");//if clothes1[playerid]=1 then the is has clothes
}
return variable;
}
Why i need this?
Because i want to make this for my clothes system. Like a command /myclothes.
I hope you know what i mean.
For myself this is a hard code to:P
Thanks Admigo
Re: Stock Variable? - [L3th4l] - 04.12.2011
pawn Код:
new clothes1[MAX_PLAYERS;
stock hasclothes1(playerid)
{
new istr[15];
if(clothes1[playerid] == 1) istr = "has clothes1";
else if(clothes1[playerid] == 0) istr = "has no clothes1";
return istr;
}
Usage:
printf("%s %s", pname(playerid), hasclothes1(playerid));
Re: Stock Variable? -
Admigo - 04.12.2011
Quote:
Originally Posted by [L3th4l]
pawn Код:
new clothes1[MAX_PLAYERS;
stock hasclothes1(playerid) { new istr[15];
if(clothes1[playerid] == 1) istr = "has clothes1"; else if(clothes1[playerid] == 0) istr = "has no clothes1";
return istr; }
Usage:
printf("%s %s", pname(playerid), hasclothes1(playerid));
|
Omg!Thank you so much! Works great!!!! Rep+