19.06.2015, 23:56
I have worked some more on my /fedit command and when I try to use it, it doesn't do anything can any one point any of my mistakes.
pawn Код:
CMD:fedit(playerid,params[]) //This is the family edit command
{
new ranks[10], motd[50], option[50];
if(pInfo[playerid][USER_FACTION] < 1 && pInfo[playerid][USER_FACTIONRANK] < 10)
{
SendClientMessage(playerid, -1, "You have no permission to use this command.");
return 1;
}
if(pInfo[playerid][USER_FACTION] > 0 && pInfo[playerid][USER_FACTIONRANK] == 10)
{
if(sscanf(params, "s[50]", option))
{
SendClientMessage(playerid, -1, "[USAGE]: /fedit (facname | rank (1-10) | motd)");
return 1;
}
if(!strcmp(option, "facname", true))
{
new Query[256], string[256], factionname[50];
format(factionname, 50, "%s", params);
if(strlen(factionname) <= 50)
{
fInfo[pInfo[playerid][USER_FACTION]][FNAME] = factionname;
format(Query, sizeof(Query), "UPDATE factioninfo SET fname = '%s' WHERE fid = %d", fInfo[pInfo[playerid][USER_FACTION]][FNAME], fInfo[pInfo[playerid][USER_FACTION]][FID]);
db_query(FDatabase, Query);
format(string, sizeof(string), "You have changed the faction name to %s.", fInfo[pInfo[playerid][USER_FACTION]][FNAME]);
SendClientMessage(playerid, -1, string);
return 1;
}
}
if(!strcmp(option, "rank", true))
{
new Query[256], string[256], rankname[10], rank;
if(sscanf(params, "ds[10]", rank, rankname))
{
SendClientMessage(playerid, -1, "[USAGE]: /fedit rank (rank number) (rank name)");
return 1;
}
switch(rank)
{
case 1:
{
format(rankname, 10, "%s", params);
if(strlen(rankname) <= 10)
{
fInfo[pInfo[playerid][USER_FACTION]][FRANK1] = rankname;
format(Query, sizeof(Query), "UPDATE factioninfo SET frank1 = '%s' WHERE fid = %d'", fInfo[pInfo[playerid][USER_FACTION]][FRANK1], fInfo[pInfo[playerid][USER_FACTION]][FID]);
db_query(FDatabase, Query);
format(string, sizeof(string), "You have changed the faction rank name to %s.", fInfo[pInfo[playerid][USER_FACTION]][FRANK1]);
SendClientMessage(playerid, -1, string);
}
}
}
}
}
return true;
}