SA-MP Forums Archive
Will this work? +1 REp! - 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: Will this work? +1 REp! (/showthread.php?tid=571900)



Will this work? +1 REp! - ChuckyBabe - 23.04.2015

I'am kinda confused if this will work.

Код:
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 by %s, reason: %s. Take a screenshot using F8 if you find this abusive.", GetPlayerNameEx(playerid), reason);
				SendClientMessageEx(COLOR_LIGHTBLUE, string);
				SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
			}
			return 1;
		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}

	return 1;
}
I don't know if that will send the msg to the victim and not to admin who uses it. The red colored code. Correct me if i'am wrong. +1 REP!


Re: Will this work? +1 REp! - BleverCastard - 23.04.2015

Stop creating a thread for every command you have, instead, try it out in-game.


Re: Will this work? +1 REp! - Konstantinos - 23.04.2015

That message should be sent to giveplayerid.

By the way, SendClientMessageEx does not have an "id" parameter so you may want to change it to normal SendClientMessage function.


Re: Will this work? +1 REp! - Jimmy0wns - 23.04.2015

Just compile it and try it for yourself, how hard could it possibly be.


Re: Will this work? +1 REp! - ChuckyBabe - 23.04.2015

Quote:
Originally Posted by BleverCastard
Посмотреть сообщение
Stop creating a thread for every command you have, instead, try it out in-game.
Then don't waste your time to look at my thread.

Quote:
Originally Posted by Jimmy0wns
Посмотреть сообщение
Just compile it and try it for yourself, how hard could it possibly be.
It's clear no warnings and errors.

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
That message should be sent to giveplayerid.

By the way, SendClientMessageEx does not have an "id" parameter so you may want to change it to normal SendClientMessage function.
I have to use it


Re: Will this work? +1 REp! - BroZeus - 23.04.2015

You haven't mentioned the 'giveplayerid' in SendClientMessageEx.
I think you need to replace that red line(SendClientMessageEx(COLOR_LIGHTBLUE, string)
with this:
PHP код:
SendClientMessageEx(giveplayeridCOLOR_LIGHTBLUEstring);
//or
SendClientMessage(giveplayeridCOLOR_LIGHTBLUEstring); 



Re: Will this work? +1 REp! - De4dpOol - 23.04.2015

Can you show the function:
SendClientMessageEx.

The SendClientMessage function have a playerid parameter which can be used to send message to specific player. You can put giveplayeid there to send message to the kicked player.

EDIT: 5 people posted while I was typing -_-


Re: Will this work? +1 REp! - ChuckyBabe - 23.04.2015

Thanks alot!


Re: Will this work? +1 REp! - iSkyline - 23.04.2015

Just replace it with this:
Код:
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
You're welcome.


Re: Will this work? +1 REp! - BleverCastard - 23.04.2015

Quote:
Originally Posted by ChuckyBabe
Посмотреть сообщение
Then don't waste your time to look at my thread.
I can hardly not look at your thread when you're creating them for every fucking command you've got on your server.