Adding gun's (Dynamic) - 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: Adding gun's (Dynamic) (
/showthread.php?tid=382019)
Adding gun's (Dynamic) -
RLGaming - 01.10.2012
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
Re: Adding gun's (Dynamic) -
RLGaming - 02.10.2012
bump
Re: Adding gun's (Dynamic) -
CmZxC - 02.10.2012
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.