How to make a variable
#1

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?
Reply
#2

No one?
Reply
#3

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
Reply
#4

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];
Reply
#5

If you wanna make Global Variable, then write
pawn Код:
new YourVariableNameHere; //at the top of your script, after your #includes
Reply
#6

pawn Код:
enum fInfo
{
    fID,
    // etc stats of faction u want to add
}
new FacInfo[MAX_FACTIONS][fInfo];
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)