Little help with KickWithMessage
#1

Ok so i have a kick command, and i have a KickWithMessage stock
Kick command:
Код:
CMD:kick(playerid, params[])
{
	if (pInfo[playerid][Adminlevel] < 2) return 0;
	new targetid, reason[64], string[128], pID;
	if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, -1, "/kick <ID> <Reason>");
	if(pID == IPI) return SCM(playerid, red, "Player is not connected!");
	format(string, sizeof(string), "%s %s has kicked %s reason: %s ", AdminLevelName(playerid), GetName(playerid), GetName(targetid), reason);
 	SendClientMessageToAll(-1, string);
	Kick(targetid);
 	return 1;
}
Stock:
Код:
forward KickPublic(playerid);

public KickPublic(playerid) { Kick(playerid); }
stock KickWithMessage(playerid, message[])
{
    SCM(playerid, 0xFF4444FF, message);
    SetTimerEx("KickPublic", 100, 0, "d", playerid);     //Delay of 1 second before kicking the player so he recieves the message
}
But i don't seem to be able to get it to work, i wanted it to say to the player: Admin Blk has kicked you reason: test
Reply
#2

pawn Код:
CMD:kick(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 2) return 0;
    new targetid, reason[64], string[128], pID;
    if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, -1, "/kick <ID> <Reason>");
    if(pID == IPI) return SCM(playerid, red, "Player is not connected!");
    format(string, sizeof(string), "%s %s has kicked %s reason: %s ", AdminLevelName(playerid), GetName(playerid), GetName(targetid), reason);
    SendClientMessageToAll(-1, string);
    SetTimerEx("KickTimer", 1000, false, "i", playerid);
    return 1;
}
pawn Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
    Kick(playerid);
    return 1;
}
Reply
#3

You're not using the function.
Change your code to this:
pawn Код:
CMD:kick(playerid, params[])
{
    if (pInfo[playerid][Adminlevel] < 2) return 0;
    new targetid, reason[64], string[128], pID;
    if(sscanf(params, "us[64]", targetid, reason)) return SendClientMessage(playerid, -1, "/kick <ID> <Reason>");
    if(pID == IPI) return SCM(playerid, red, "Player is not connected!");
    format(string, sizeof(string), "%s %s has kicked %s reason: %s ", AdminLevelName(playerid), GetName(playerid), GetName(targetid), reason);
    KickWithMessage(playerid, string);
    return 1;
}
Reply
#4

Rudy_ thanks for the help, i would rep you but i need 50 post D: thanks again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)