16.05.2017, 09:50
This is what I ended up with.
Ingame it gives me all the licenses at the same time rather than waiting for the parameter to be inputted.
Код:
CMD:issuelicense(playerid, params[]) { new PID; new string[128]; new param[144]; new Float:X; new Float:Y; new Float:Z; GetPlayerPos(PID, X, Y, Z); if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z)) if(sscanf(params, "us[144]", PID, param)) { SendClientMessage(playerid, COLOR_GREY, "[Usage:] /issuelicense [playerid/partofname] [param]"); SendClientMessage(playerid, COLOR_GREY, "PARAMS: PF, BLS"); SendClientMessage(playerid, COLOR_GREY, "TIP: If you want to revoke a license, use /revokelicense."); } if(!strcmp(param, "PF")) { PlayerInfo[playerid][pPF] = 1; format(string, sizeof(string), "You have given %s a PF license.", RPN(playerid)); SendClientMessage(playerid, -1, string); format(string, sizeof(string), "%s has given you a PF license.", RPN(playerid)); SendClientMessage(PID, -1, string); } if(!strcmp(param, "BLS")) { PlayerInfo[playerid][pBLS] = 1; format(string, sizeof(string), "You have given %s a BLS license.", RPN(playerid)); SendClientMessage(playerid, -1, string); format(string, sizeof(string), "%s has given you a BLS license.", RPN(playerid)); SendClientMessage(PID, -1, string); } return 1; } CMD:revokelicense(playerid, params[]) { new PID; new string[128]; new param[144]; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "us[144]", PID, param)) { SendClientMessage(playerid, COLOR_GREY, "[Usage:] /revokelicense [playerid/partofname] [param]"); SendClientMessage(playerid, COLOR_GREY, "PARAMS: PF, BLS"); SendClientMessage(playerid, COLOR_GREY, "TIP: If you want to give a license, use /issuelicense."); } if(!strcmp(param, "PF")) { PlayerInfo[playerid][pPF] = 0; format(string, sizeof(string), "You have revoked %s's PF license.", RPN(playerid)); SendClientMessage(playerid, -1, string); format(string, sizeof(string), "%s has revoked your PF license.", RPN(playerid)); SendClientMessage(PID, -1, string); } if(!strcmp(param, "BLS")) { PlayerInfo[playerid][pBLS] = 0; format(string, sizeof(string), "You have revoked %s's BLS license.", RPN(playerid)); SendClientMessage(playerid, -1, string); format(string, sizeof(string), "%s has revoked your BLS license.", RPN(playerid)); SendClientMessage(PID, -1, string); } return 1; }