SA-MP Forums Archive
Little help with KickWithMessage - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Little help with KickWithMessage (/showthread.php?tid=542826)



Little help with KickWithMessage - KyLeBlaK - 22.10.2014

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


Re: Little help with KickWithMessage - Rudy_ - 22.10.2014

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;
}



Re: Little help with KickWithMessage - Stinged - 22.10.2014

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;
}



Re: Little help with KickWithMessage - KyLeBlaK - 22.10.2014

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