SA-MP Forums Archive
Kick with Reason - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Kick with Reason (/showthread.php?tid=129166)



Kick with Reason - juuleman - 21.02.2010

Hey all,

Im using pen1 but the /kick command included in that GM doesnt have a Reason function.
I saw the godfather has a /kick id reason function so i copied that code to pen1:

Код:
//----------------------------------[Kick]------------------------------------------------
  if(strcmp(cmd, "/kick", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
				return 1;
			}
		  giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
					  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						Kick(giveplayerid);
						format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_RED, string);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
But now im getting this error:
Код:
error 017: undefined symbol "ReturnUser"
I tried to define it like this:
Код:
new ReturnUser;
But then i get even more errors....

Can someone help me? Thanks




Re: Kick with Reason - WackoX - 21.02.2010

Use DCMD or ZCMD, mutch easyer and faster.


Re: Kick with Reason - juuleman - 21.02.2010

Quote:
Originally Posted by WackoX
Use DCMD or ZCMD, mutch easyer and faster.
What is that?

Give me a link or something.

EDIT: I already saw what DCMD was but i dont really like it, can you help me with my original problem?