18.07.2014, 15:34
Hello, today i bring up a small issue with my script, i been trying to create a "kick" and "setskin" command, here's the code for both and the issue below them.;..
Kick:
Issue:
It kicks fine but i want the message to show the reason they were kicked BEFORE their connection is closed.
SetSkin:
Issue:
The command doesn't change their skin and it doesn't update in the user file.
Kick:
Код:
CMD:kick(playerid, params[]) { if(PlayerInfo[playerid][pAdminLevel] >=5) { new PID; new reason[64]; new str[128]; new PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME]; GetPlayerName(playerid, AName, sizeof(AName)); GetPlayerName(PID, PName, sizeof(PName)); if(sscanf(params, "us[64]", PID, reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!"); format(str, sizeof(str), "'%s' You have been kicked by '%s'. Reason: %s ", PName, AName, reason); SendClientMessage(PID, COLOR_RED, str); SetTimerEx("KickTimer", 2000, false, "i", playerid); Kick(PID); } else { SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command"); } return 1; }
It kicks fine but i want the message to show the reason they were kicked BEFORE their connection is closed.
SetSkin:
Код:
CMD:setskin(playerid, params[]) { new PID, param, PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME]; GetPlayerName(playerid, AName, sizeof(AName)); GetPlayerName(PID, PName, sizeof(PName)); if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command"); if(sscanf(params, "ui", PID, pAdminLevel)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setskin [playerid] [SkinID]"); if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!"); PlayerInfo[playerid][pSkin] = param; SetPlayerSkin(PID, param); return 1; }
The command doesn't change their skin and it doesn't update in the user file.