02.06.2020, 10:50
Hello everyone, I know this is a pretty minor error. I can't for the life of me work it out, kick command; a message gets sent to all players, a message gets sent to the staff member who kicked, these 2 lines work correctly.
The line sending the message to the kicked player doesn't function properly tho, nothing is sent, and the delay doesn't seem to work either.
Would love some help with this
Thank you for your time and assitance!
The line sending the message to the kicked player doesn't function properly tho, nothing is sent, and the delay doesn't seem to work either.
Would love some help with this
Code:
forward kickdelays(playerid); forward KickTimer(playerid);
Code:
public kickdelays(playerid) { Kick(playerid); }
Code:
CMD:kick(playerid, params[]) { if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, WHITE, "Server: Unknown command."); new stringadm[144]; new str[144], id, reason[144]; if(pInfo[playerid][pLogin] == 0) return SendClientMessage(playerid, RED, "Register or Login first before using this command!"); if(pInfo[playerid][pAdmin] >= 1) { if(sscanf(params, "us[30]", id, reason)) return SendClientMessage(playerid, RED, "USAGE: /kick [id] [reason]"); if (pInfo[id][pAdmin] > pInfo[playerid][pAdmin]) return SendClientMessage(playerid, RED, "ERROR: You cannot Kick Admins who are a higher Rank than you."); if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "ERROR: Invalid ID!"); if(id == playerid) return SendClientMessage(playerid, RED, "You cannot kick yourself!"); format(str, sizeof(str), "%s (%d) has been kicked by %s (%d) | Reason: %s", GetName(id), id, GetName(playerid), playerid, reason); SendClientMessageToAll(RED, str); // informs all players somebody has been kicked. format(str, sizeof(str), "You have kicked %s (%d) | Reason: %s", GetName(id), id, reason); SendClientMessage(playerid, RED, str); // Informs the staff who kicked, they've kicked someone SetTimerEx("kickdelays", 3000, false, "i", id); // delay the kick format(str, sizeof(str), "%s (%d) kicked you | Reason: %s", GetName(playerid), id, reason); SendClientMessage(id, RED, str); // informs the kicked person they've been kicked. Kick(id); format(stringadm,sizeof(stringadm),"[ADM]: %s used /kick",GetName(playerid)); SendToAdmin(COLOR_ADM,stringadm); } else return SendClientMessage(playerid, WHITE, "Server: Unknown command."); return 1; }