Dynamic editing?
#1

Okay, simple request.

I need to know and see how to edit parts of the script in-game. I'm currently making my faction system dynamic, and I have defines set up for all the locations. I need to know how to edit the below with a command in-game.

pawn Код:
#define faction1name "LSPD"
#define faction1radio 0x005EBB00
#define faction1badge 0x0000FF00
#define faction1color 0x0000FFFF
#define faction1rankdef "Cadet"
#define faction1rank1 "Officer I"
#define faction1rank2 "Officer II"
#define faction1rank3 "Corporal"
#define faction1rank4 "Sergeant"
#define faction1rank5 "Staff Sergeant"
#define faction1rank6 "Lieutenant"
#define faction1rank7 "Captain"
#define faction1rank8 "Deputy Chief"
#define faction1rank9 "Chief of Police"
#define faction1divdef "G.D."
#define faction1div1 "PTL"
#define faction1div2 "FTO"
#define faction1div3 "undefined"
#define faction1div4 "undefined"
#define faction1div5 "undefined"
#define faction1div6 "undefined"
#define faction1div7 "undefined"
#define faction1div8 "OPS"
#define faction1div9 "ADM"
Reputation and my greatest thanks! (-:
Reply
#2

It needs to be stored in a location that the server can access and modify, such as an ini file or a database.
Reply
#3

I know that. I'm just un-sure how to make the command its self.
Reply
#4

What file/storing system do you want to use? Dini? Y_ini?
Reply
#5

First, you will have to create the saving/loading for them (also create enumerators, would be better) then do something like this
pawn Код:
CMD:changefname(playerid, params[])
{
       if(!isnull(params)) return strcat(FactionInfo[1][fname], params, 160);
       return 1;
}
The isnull means if his input is empty (you can search for it's #define on forums) and strcat is for copying strings and assigning that string to a value.

https://sampwiki.blast.hk/wiki/Strcat

If you fail to get what I am saying, you can check my filterscript it has the features you are asking for, and I think reading code is better.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)