Sending message to all
#1

I don't understand why it's sending the msg to all even it's in SendClientMessageEx format and 'giveplayerid' here's the code

Код:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
				Log("logs/kick.log", string);
				format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				/*format(string, sizeof(string), "You have been kicked out by %s, reason: %s. Take a screenshot using F8 if you find this abusive.", GetPlayerNameEx(playerid), reason);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);*/
				SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
			}
			return 1;
		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}

	return 1;
}
Also it's not kicking the player who i want to kick. +1 REP!
Reply
#2

bump!
Reply
#3

I thought 'GetPlayerIP' is not important to share.

Код:
forward DelayKick(playerid);
public DelayKick(playerid)
{
        Kick(playerid);
        return 1;
}
Код:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    new giveplayerid;
	    new reason[100];
	    if(!sscanf(params, "us[70]", giveplayerid,reason))
	    {
	    	if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GREY,"ERROR: That player is not connected");
	    	if(PlayerInfo[giveplayerid[pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < put high admin level here) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Only Administrators Rank 4 and up can kick other Administrators.");
			new tname[MAX_PLAYER_NAME];
			GetPlayerName(Target,tname,sizeof(tname));
			new pname[MAX_PLAYER_NAME];
			GetPlayerName(playerid,pname,sizeof(pname));
			new AllString[256];
			format(AllString,sizeof(AllString),"AdmCmd: %s has been kicked by %s.",tname, GetName(playerid));
			SendClientMessage(giveplayerid,COLOR_LIGHTRED,AllString);
			format(AllString,sizeof(AllString),"Reason: %s", Reason);
			SendClientMessage(giveplayerid,COLOR_LIGHTRED,AllString);
			SetTimerEx("DelayKick", 1000, false, "d", giveplayerid);
		}
	    else SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid/name] [reason]");
	}
	else SendClientMessage(playerid, COLOR_GREY, "ERROR: You don't have the privilege to use this command!");
	return 1;
}
Reply
#4

Quote:
Originally Posted by justice96
Посмотреть сообщение
I thought 'GetPlayerIP' is not important to share.

Код:
forward DelayKick(playerid);
public DelayKick(playerid)
{
        Kick(playerid);
        return 1;
}
Код:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
	    new giveplayerid;
	    new reason[100];
	    if(!sscanf(params, "us[70]", giveplayerid,reason))
	    {
	    	if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GREY,"ERROR: That player is not connected");
	    	if(PlayerInfo[giveplayerid[pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] < put high admin level here) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Only Administrators Rank 4 and up can kick other Administrators.");
			new tname[MAX_PLAYER_NAME];
			GetPlayerName(Target,tname,sizeof(tname));
			new pname[MAX_PLAYER_NAME];
			GetPlayerName(playerid,pname,sizeof(pname));
			new AllString[256];
			format(AllString,sizeof(AllString),"AdmCmd: %s has been kicked by %s.",tname, GetName(playerid));
			SendClientMessageToAll(COLOR_LIGHTRED,AllString);
			format(AllString,sizeof(AllString),"Reason: %s", Reason);
			SendClientMessageToAll(COLOR_LIGHTRED,AllString);
			SetTimerEx("DelayKick", 1000, false, "d", giveplayerid);
		}
	    else SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid/name] [reason]");
	}
	else SendClientMessage(playerid, COLOR_GREY, "ERROR: You don't have the privilege to use this command!");
	return 1;
}
I want it will only send it to the victim and not to all, i mean giveplayerid.
Reply
#5

Quote:
Originally Posted by ChuckyBabe
Посмотреть сообщение
I want it will only send it to the victim and not to all, i mean giveplayerid.
SendClientMessage(giveplayerid,COLOR_LIGHTRED,AllS tring); just like that, whats wrong with it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)