13.10.2014, 08:35
Okay so this is my new command. Maybe this will give more insight into what I'm trying to do. I'm trying to check all of the Faction's names to see if they are equal to the faction name the user has entered, if they match then I want it to send an error stating that there is already a faction named that. If they don't I want it to continue on. However I'm doing things very wrong I'm sure, and this command currently doesn't work. I'm just trying to create a scaffold sort of thing.
Код:
CMD:createfaction(playerid, params[]) { new factionname[32], string[128], query[128]; if(pInfo[playerid][pAdmin] < HEAD_ADMIN) return ErrorMessage(playerid); if(sscanf(params, "s[32]", factionname)) return SendClientMessage(playerid, cred, "USAGE: /createfaction [factionname]"); for(new i = 0; i <= Total_Factions_Created; i++) { if(!strcmp(factionname, fInfo[i][Name], true)) { SendClientMessage(playerid, cred, "That faction has already been created!"); } else { fInfo[i][ID] = i; fInfo[i][Name] = factionname; format(query, sizeof(query), "INSERT INTO `factiondata` (id, name) VALUES('%d', '%s')", fInfo[i][ID], fInfo[i][Name]); mysql_query(query); format(string, sizeof(string), "You just created a faction called, %s.", fInfo[i][Name]); SendClientMessage(playerid, cwhite, string); } } return 1; }