• Welcome to Vice City Multiplayer.
 

How to kick

Started by asad3man, April 24, 2011, 07:35:29 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

yazeen


asad3man

when i put it and compile it it says Error


stormeus

Delete where it says:

                return 1;
}

asad3man

tahnx Stormous thanx

asad3man

#20
Quote from: yazeen on April 24, 2011, 02:38:45 PM
/c kick [Nick/Id] [Reason](Credits to me)

   }
else if (strcmp(cmd, "kick", true) == 0) {
new reason[256], plr, szMsg[256];
tmp = strtok(cmdtext, idx), reason = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(IsPlayerAdmin(playerid))
else if (!strlen(reason)) SendClientMessage(playerid,0xFFFF00AA,"USAGE: /c kick [Nick/ID] [Reason]");
  else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,0xFFFF00AA,"Error: Unknown player");
else {
format(szMsg,sizeof(szMsg),"Admin: %s kicked player:[ %s ] Reason:[ %s ]",gPlayers[playerid],gPlayers[plr],cmdtext[strlen(tmp)+6]);
SendClientMessageToAll(0xFFFF00AA,szMsg);
Kick(plr);
}


If u Dont Have FindPlayerIdFromString Function Add it  (Credits to bakasan

public FindPlayerIDFromString(string[])
{// for determining player id from a string  -bakasan
new player = INACTIVE_PLAYER_ID;
new p = 0;
while (p < MAX_PLAYERS) { if (strfind(gPlayers[p],string,true) != -1) { player=p;break; } p++; }
if (player == INACTIVE_PLAYER_ID) {// string didnt match so check if it can be an id
if ((strlen(string) > 2) || (isnumeric(string) == 0)) { return INACTIVE_PLAYER_ID; }
player = strval(string);// string is numeric and not more than 2 digits
}
if (!IsPlayerConnected(player)) { return INACTIVE_PLAYER_ID; }
return player;// valid id found
}
return 1;
}


Unban/Ban Command(Credits to madara)
UnBan/Ban By madara


How to use these 1st one
When i am using 2nd one then reason isnot coming Why tell me i want to use 1st one When i put it it gives a huge list of error


stormeus

Quote from: asad3man on April 25, 2011, 11:44:57 AM
[IMG=http://img233.imageshack.us/img233/9922/25305695.png][/IMG]

Uploaded with ImageShack.us

First thing: what happened to FindPlayerIDFromString()? It looks like you completely erased it. Replace this code:
public FindPlayerIDFromString(string)
{}


With this code:

public FindPlayerIDFromString(string[])
{// for determining player id from a string  -bakasan
new player = INACTIVE_PLAYER_ID;
new p = 0;
while (p < MAX_PLAYERS)
{
if (strfind(gPlayers[p],string,true) != -1)
{
player = p;
break;
}
p++;
}
if (player == INACTIVE_PLAYER_ID) {// string didnt match so check if it can be an id
if ((strlen(string) > 2) || (isnumeric(string) == 0)) { return INACTIVE_PLAYER_ID; }
player = strval(string);// string is numeric and not more than 2 digits
}
if (!IsPlayerConnected(player)) { return INACTIVE_PLAYER_ID; }
return player;// valid id found
}


Another problem is that your code isn't in the right place. Everything between if (strcmp and Kick(plr); } should be somewhere in OnPlayerCommandText.

asad3man

hey i need to kick  players with reason is it without Reasonable....

stormeus

Quote from: asad3man on April 25, 2011, 01:19:04 PM
hey i need to kick  players with reason is it without Reasonable....

If you get rid of this line:
else if (!strlen(reason)) SendClientMessage(playerid,0xFFFF00AA,"USAGE: /c kick [Nick/ID] [Reason]");

You won't need a reason to kick.

asad3man

i want to kick with reason what   i have to add

stormeus

Quote from: asad3man on April 25, 2011, 01:55:01 PM
i want to kick with reason what   i have to add

You don't have to add anything to kick with reasons.

asad3man

when i kick  like this /kick 1 lolz then it just kick dont give reason and give me fulll COmmands of VC-MP server

Kill3R

Quote from: asad3man on April 25, 2011, 02:40:36 PM
when i kick  like this /kick 1 lolz then it just kick dont give reason and give me fulll COmmands of VC-MP server

You need to script if you want reason and other stuffs to be displayed, you have a choice of using Pawno / mIRC (which is obsolete atm).

/kick command is a RCON cmd, so it just kicks the player based on the given plr id, you can't display reason or any other statements over there.

Regards,
Kill3R

BIG[H]

Troll noob

Use Common Sense .. In Script .pwn
My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL