Command Not Working - 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: Command Not Working (
/showthread.php?tid=497819)
Command Not Working -
Chrillzen - 28.02.2014
pawn Код:
CMD:factioninfo(playerid, params[])
{
new
string[128], string2[256], id;
if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "[Usage]: /factioninfo [factionID]");
if(id < 1 || id > 10 ) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction ID.");
for(new f = 1;f < sizeof(FactionInfo);f++)
{
if(f == id)
{
SCM(playerid, COLOR_GREEN, "_______________________________"COL_WHITE"[FACTION INFO]"COL_GREEN"_______________________________");
format(string, sizeof(string), "Name: %s", FactionInfo[id][fName]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Members: %d", FactionInfo[id][fMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string2, sizeof(string2), "Information: %s", FactionInfo[id][fInformation]);
SendClientMessage(playerid, COLOR_WHITE, string2);
break;
}
}
return 1;
}
Doesn't load real information. I suspect something is wrong with this line.
I want to loop through the 10 static factions and pick the one that matches the id I wrote in the command.
Re: Command Not Working -
Konstantinos - 28.02.2014
What's the point on using a loop? You already got
id as index.
Re: Command Not Working -
Chrillzen - 28.02.2014
I don't know... Still not working.
pawn Код:
CMD:factioninfo(playerid, params[])
{
new
string[128], string2[256], id;
if(sscanf(params, "d", id)) return SendClientMessage(playerid, COLOR_GREY, "[Usage]: /factioninfo [factionID]");
if(id < 1 || id > 10 ) return SCM(playerid, COLOR_LIGHTRED, "Invalid faction ID.");
SCM(playerid, COLOR_GREEN, "_______________________________"COL_WHITE"[FACTION INFO]"COL_GREEN"_______________________________");
format(string, sizeof(string), "Name: %s", FactionInfo[id][fName]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "Members: %d", FactionInfo[id][fMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string2, sizeof(string2), "Information: %s", FactionInfo[id][fInformation]);
SendClientMessage(playerid, COLOR_WHITE, string2);
return 1;
}
It saves in scriptfiles correctly. And I load it in the script. I haven't learned everything about y_ini yet.