CMD:warn(playerid, params[]) { new AdminName[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], id, string[1000], Warnings[MAX_PLAYERS], Reason[100]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Only Admins Can Be Use This Command [ ! ]"); if(sscanf(params, "us", id, Reason)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /warn [Player-ID] [Reason]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Invalid-Player-ID [ ! ]"); if(id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You Can't Warn Your Self [ ! ]"); GetPlayerName(playerid, AdminName, sizeof(AdminName)); GetPlayerName(id, PlayerName, sizeof(PlayerName)); If(Warnings[playerid] == 1) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 1/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, string); } If(Warnings[playerid] == 2) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 2/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, string); } If(Warnings[playerid] == 3) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Kicked {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : 3/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, strin); Kick(id); } for(new pid = 0; pid < MAX_PLAYERS; pid++) { PlayerPlaySound(pid, 1057, 0.0, 0.0, 0.0); } return 1; } |
Warnings[playerid]
Warnings[id]
Warnings[id]
The warning messages are not shown because you used:
pawn Код:
pawn Код:
Reduce the spacing and remove the colors so it can fit the whole message. Checking if each warning is 1/2/3 is pointless. Just use one message and pass: pawn Код:
|
So if he use [playerid] then the target player that will show the message is the one who use the command? a'm I right?
|
CMD:warn(playerid, params[]) { new AdminName[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], id, string[1000], Warnings[MAX_PLAYERS], Reason[100]; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Only Admins Can Be Use This Command [ ! ]"); if(sscanf(params, "us", id, Reason)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage : /awarn [Player-ID] [Reason]"); if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] Invalid-Player-ID [ ! ]"); if(id == playerid) return SendClientMessage(playerid, 0xFF0000FF, "[ ! ] You Can't Warn Your Self [ ! ]"); GetPlayerName(playerid, AdminName, sizeof(AdminName)); GetPlayerName(id, PlayerName, sizeof(PlayerName)); if(Warnings[id] == 1) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, string); } if(Warnings[id] == 2) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Warned {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, string); } if(Warnings[id] == 3) { format(string, sizeof(string), "{FFFF00}[ ! ] Player : %s (ID : %d) Has Been {FF0000}Kicked {FFFF00}By {8000FF}Admin : %s (ID : %d) {FFFF00}Reason : %s Warnings : %d/3 [ ! ]", PlayerName, id, AdminName, playerid, Reason); SendClientMessageToAll(playerid, string); Kick(id); } for(new pid = 0; pid < MAX_PLAYERS; pid++) { PlayerPlaySound(pid, 1057, 0.0, 0.0, 0.0); } return 1; } |