17.07.2014, 16:36
So yeah as the title tells i have a problem with this command which only works with rcon, wonder if this command could be changed so only normal admins could use it and remove all the rcon thing from the script. if someone would solve my problem much respect for him +rep <3
one of my fine working commands (just an example)
Код:
COMMAND:ask(playerid, params[]) { if (sscanf(params, "s[256]", Question[playerid])) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ask [Question]"); if(QuestionAsked[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "ERROR: Wait for the response of your previous question!"); new string[128], string2[256], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string2, sizeof(string2), "QUESTION: %s", Question[playerid]); SendClientMessageToAdmins(COLOR_GREEN, string2); format(string, sizeof(string), "INFO: %s has asked a question, use /answer %d to answer it!", name, playerid); SendClientMessageToAdmins(COLOR_GREEN, string); QuestionAsked[playerid] = true; return 1; } COMMAND:answer(playerid, params[]) { new ID, string[256], string2[256]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This command is only available for RCON admins!"); if (sscanf(params, "is[256]", ID, string)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /answer [ID] [Answer]"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected!"); if(QuestionAsked[ID] != true) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has not asked a question!"); QuestionAsked[ID] = false; format(string2, sizeof(string2), "ANSWER: %s", string); SendClientMessage(ID, COLOR_GREEN, string2); return 1; } COMMAND:qdelete(playerid, params[]) { new ID; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This command is only available for RCON admins!"); if (sscanf(params, "i", ID)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /qdelete [ID]"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected!"); if(QuestionAsked[ID] != true) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has not asked a question!"); QuestionAsked[ID] = false; SendClientMessage(ID, COLOR_GREEN, "INFO: Your question has been deleted!"); return 1; }
Код:
CMD:kick(playerid,params[]) { if(pInfo[playerid][pLogged] == 1) { if(pInfo[playerid][pAdminLevel] >= 1) { new targetid,reason[105],string[256]; if(sscanf(params, "us[105]", targetid,reason)) return SendClientMessage(playerid,-1,""chat" /kick [playerid] [reason]"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online"); format(string, sizeof(string), ""chat""COL_LIGHTBLUE" %s %s has kicked %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason); SCMTA(-1,string); printf("%s %s has kicked %s [Reason: %s]",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid),reason); Kick(targetid); } else { SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!"); } } else if(pInfo[playerid][pLogged] == 0) { SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!"); printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid)); Kick(playerid); } return 1; }