How to make a 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: How to make a variable (
/showthread.php?tid=527291)
How to make a variable -
Cole_William - 21.07.2014
So i been trying to make a fID[MAX_FACTIONS] thing working, i want it to look up the ID of the faction but it wont.. i have in enum as
I have MAX_FACTIONS Defined as 50
#define MAX_FACTIONS 50
fID[MAX_FACTIONS],
and the
new FacInfo[MAX_FACTIONS][fInfo]
So how do i get fID to look up the id of the faction and open that file?
Re: How to make a variable -
Cole_William - 22.07.2014
No one?
Re: How to make a variable -
BlackM - 22.07.2014
Well what you can do is retrieve the faction ID of a player and place it in the first dimension of FacInfo for example:
Код:
CMD:arrest(playerid, params) // arresting command
{
new targetid;
If(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1, "Usage");
new fID = Playerinfo[playerid][factionID];
If( FacInfo[fID][CanArrest] != true) return SendClientMessage(playerid, -1, "Your faction does not authorise you to arrest!");
ArrestPlayer(targetid);
}
Hope this helped u
Re: How to make a variable -
Cole_William - 22.07.2014
Quote:
Originally Posted by BlackM
Well what you can do is retrieve the faction ID of a player and place it in the first dimension of FacInfo for example:
Код:
CMD:arrest(playerid, params) // arresting command
{
new targetid;
If(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1, "Usage");
new fID = Playerinfo[playerid][factionID];
If( FacInfo[fID][CanArrest] != true) return SendClientMessage(playerid, -1, "Your faction does not authorise you to arrest!");
ArrestPlayer(targetid);
}
Hope this helped u 
|
How can i make it a global variable, cause i want it to be like
ID = FacInfo[MAX_FACTIONS][fInfo];
How do we make MAX_FACTIONS look up the proper file??
"/facitons/%i", FactionInfo[ID][fInfo];
Re: How to make a variable -
[D]ry[D]esert - 22.07.2014
If you wanna make Global Variable, then write
pawn Код:
new YourVariableNameHere; //at the top of your script, after your #includes
Re: How to make a variable -
Sawalha - 22.07.2014
pawn Код:
enum fInfo
{
fID,
// etc stats of faction u want to add
}
new FacInfo[MAX_FACTIONS][fInfo];
?