Help with #define - 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: Help with #define (
/showthread.php?tid=451764)
Help with #define -
ZeroTheScyther - 18.07.2013
Ok sa I'm trying to make a /status script and I got a problem at the Faction part.
So I'm using YSI to save my accounts, on the player register they'll be automatically seted in the "Middlers" team
PHP код:
#define Middler 5 //Civilans
#define Havoc 6 // Havoc
PHP код:
gTeam[playerid] = Middler;
to skip any other useless words I'll say it directly. When the player types /status at Faction he sees the ID of the faction I defined and not the faction name. Is there any way to change that ID to with the original name or with a name? I mean can I #define Middlers "Middlers" or something like that?
Re: Help with #define -
faff - 18.07.2013
Hmm...
Why you wont use INI, to save faction information?
Anyways..
Show us the /status command.
pawn Код:
format(Middler, 32, "Civillian")
format(Havoc, 32, "Havoc");
Re: Help with #define -
ZeroTheScyther - 18.07.2013
PHP код:
if (strcmp("/status", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
new string1[128],stats[1024];
format(string1,sizeof(string1),"Nume:%s\nSkill:%d\nBani:%d\nFactiune:%d",name,PlayerInfo[playerid][wSkill],PlayerInfo[playerid][pCash],gTeam[playerid]);
format(stats, sizeof stats, "%s", string1);
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Your account:",stats,"Ok","");
}
}
Here's the command Nume = Name, Bani = Money and Factiune = Faction
Re: Help with #define -
faff - 18.07.2013
Not tested.
pawn Код:
if (strcmp("/status", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
new string1[128],stats[1024];
new facname[32];
if(gTeam[playerid] == 1) format(facname, 32, "Civillian");
if(gTeam[playerid] == 2) format(facname, 32, "Havoc");
format(string1,sizeof(string1),"Nume:%s\nSkill:%d\nBani:%d\nFactiune:%d",name,PlayerInfo[playerid][wSkill],PlayerInfo[playerid][pCash],facname);
format(stats, sizeof stats, "%s", string1);
ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Your account:",stats,"Ok","");
}
}
Re: Help with #define -
ZeroTheScyther - 18.07.2013
Nevermind I edited some points and everything is working just fine. Thank you for the fast reply. +Rep
Re: Help with #define -
faff - 18.07.2013
Oh yes, My bad.