Setskin & Kick Command | Help
#1

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:
Код:
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;
}
Issue:
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;
}
Issue:
The command doesn't change their skin and it doesn't update in the user file.
Reply
#2

Helped OP over Skype.
Reply
#3

What Mionee helped with:

Kick
Код:
SendClientMessage(PID, COLOR_RED, str);
SetTimerEx("KickTimer", 2000, false, "i", playerid); // Changed Playerid to PID
Kick(PID); // MUST BE IN THE TIMER CALLBACK
Setskin
Код:
 if(sscanf(params, "ui", PID, pAdminLevel)) // Changed "pAdminLevel" to param
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)