Adding gun's (Dynamic)
#1

So I have this Dynamic Faction System, I am trying to get it so when I do /editfactionguns it will come up with a sscanf thing and you can do /editfactionguns [factionid] [gunids] for example: /editfactionguns facidhere 24, 29, 30

So that would create a deagle since its ID 24, an MP5 and an AK47

But, how can I do that with sscanf? and add it to that factions weapons thing, I already have saving for it

My CMD:
Код:
CMD:editfactionguns(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command!");
	new iFac, weapons, string[128];
    if(sscanf(params, "ds[32]", iFac, weapons)) return SendClientMessage(playerid, -1, "USAGE: /editfactionguns [factionid] [gun IDs]");
   	else
	{
	    arrFaction[iFac][g_iLockerGuns] = weapons;
 		format(string, sizeof(string), "You have modified faction ID %i weapon's too: %s.", iFac, weapons);
        SendClientMessage(playerid, COLOR_WHITE, string);
        SaveDynamicFactions();
	}
	return 1;
}
+rep thanks
Reply
#2

bump
Reply
#3

for love of god use [.pawn] tags instead of [.code]

anyway:

pawn Код:
CMD:editfactionguns(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command!");
    new iFac, weapons, string[128];
    if(sscanf(params, "di", iFac, weapons)) return SendClientMessage(playerid, -1, "USAGE: /editfactionguns [factionid] [gun IDs]");
    arrFaction[iFac][g_iLockerGuns] = weapons;
    format(string, sizeof(string), "You have modified faction ID %i weapon's too: %s.", iFac, weapons);
    SendClientMessage(playerid, COLOR_WHITE, string);
    SaveDynamicFactions();
    return 1;
}
issues were :
unnecessary "else" after if(sscanf..
weapon IDs are integers, not strings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)