10.12.2013, 00:57
So I know how to script it (kinda) but I cant figure out the layout for it, so I'll do my best to explain this.
So I want it to be the command /update, then it will be like /update [option] [option2] [texthere]
Options will be: Updates, Rules, Motd, Reminders
Option2 will be:....
For Updates Option: MajorUpdate, or Update
For Rules Option: ServerRules, or GangRules
For Motd Option: No other option
Now what i need to do is be able to do like for example I will do /update rules
Now I would need to figure out how to make it that for options2 make it so I could type /update rules serverrules [Text here]
It is like where I got more options inside of a command I need help with.
here is what i got so far
So I want it to be the command /update, then it will be like /update [option] [option2] [texthere]
Options will be: Updates, Rules, Motd, Reminders
Option2 will be:....
For Updates Option: MajorUpdate, or Update
For Rules Option: ServerRules, or GangRules
For Motd Option: No other option
Now what i need to do is be able to do like for example I will do /update rules
Now I would need to figure out how to make it that for options2 make it so I could type /update rules serverrules [Text here]
It is like where I got more options inside of a command I need help with.
here is what i got so far
Код:
CMD:update(playerid, params[]) { // Calculating new Year, Month, Day, Hour, Minute, option[32], option1[32], string[128]; getdate(Year, Month, Day); gettime(Hour, Minute); { new ActualDay; PlayerInfo[playerid][pIDay] = ActualDay; PlayerInfo[playerid][pIMonth] = Month; PlayerInfo[playerid][pIDay] = Day; PlayerInfo[playerid][pIMonth] = Month; PlayerInfo[playerid][pIYear] = Year; PlayerInfo[playerid][pIHour] = Hour; PlayerInfo[playerid][pIMinute] = Minute; } if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pAdmin] < 1338) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(strlen(params) > 128) return SendClientMessage(playerid, COLOR_GREY, "Maximum characters limit is 128."); if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on Admin Duty."); if(sscanf(params, "s[32]s[32]s[128]", option, option1, params)) { SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /update [option] [option1] [text]"); SendClientMessage(playerid, COLOR_GREY, "OPTIONS: updates, motd, rules, reminders"); return 1; } if(!strcmp(option, "updates", true)) { new File: file = fopen("updates.cfg", io_append); format(string, sizeof(string), "%s - [%d/%d/%d - %d:%d]\r\n", params, PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear], PlayerInfo[playerid][pIHour], PlayerInfo[playerid][pIMinute]); fwrite(file, string); fclose(file); format(string, sizeof(string), "AdmCmd: %s has posted updates, use /updates to view it.", RPN(playerid)); SendClientMessageToAll(COLOR_LIGHTRED, string); return 1; } if(!strcmp(option, "reminders", true)) { new File: file = fopen("reminders.cfg", io_append); format(string, sizeof(string), "%s - [%d/%d/%d - %d:%d]\r\n", params, PlayerInfo[playerid][pIMonth], PlayerInfo[playerid][pIDay], PlayerInfo[playerid][pIYear], PlayerInfo[playerid][pIHour], PlayerInfo[playerid][pIMinute]); fwrite(file, string); fclose(file); format(string, sizeof(string), "AdmWarn: %s has posted reminders, use /reminders to view it.", RPN(playerid)); SendAdminMessage(COLOR_DARKRED, 1, string); return 1; } else if(!strcmp(option, "motd", true)) { format(ServerMOTD, sizeof(ServerMOTD), "%s", params); format(string, sizeof(string), "AdmCmd: %s has changed the message of the day to %s.", RPN(playerid), params); SendClientMessageToAll(COLOR_LIGHTRED, string); return 1; } return 1; }