SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 01/08/2012, 01:48 PM   #1
P<3TS
Big Clucker
 
Join Date: Jul 2012
Posts: 136
Reputation: 21
Default kicking player during...

hello, how can i make a player join with a name of numeric get kicked from the server?
P<3TS is offline   Reply With Quote
Old 01/08/2012, 01:53 PM   #2
Disturn
Guest
 
Posts: n/a
Default Re: kicking player during...

pawn Code:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}

Last edited by Disturn; 01/08/2012 at 02:44 PM.
  Reply With Quote
Old 01/08/2012, 01:57 PM   #3
P<3TS
Big Clucker
 
Join Date: Jul 2012
Posts: 136
Reputation: 21
Default Re: kicking player during...

So how the code will come ?
P<3TS is offline   Reply With Quote
Old 01/08/2012, 02:44 PM   #4
Disturn
Guest
 
Posts: n/a
Default Re: kicking player during...

Quote:
Originally Posted by P<3TS View Post
So how the code will come ?
pawn Code:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYERS+1];
    GetPlayerName(playerid, name, sizeof(name));
    if(IsNumeric(name))
    {
        Kick(playerid);
        return 1;
    }
    return 1;
}
  Reply With Quote
Old 02/08/2012, 06:56 AM   #5
P<3TS
Big Clucker
 
Join Date: Jul 2012
Posts: 136
Reputation: 21
Default Re: kicking player during...

it is not working :SS
P<3TS is offline   Reply With Quote
Old 02/08/2012, 07:10 AM   #6
[MM]RoXoR[FS]
Gangsta
 
[MM]RoXoR[FS]'s Avatar
 
Join Date: Mar 2012
Location: Gurgaon,India
Posts: 738
Reputation: 138
Default Re: kicking player during...

pawn Code:
public OnPlayerConnect(playerid)
{
 new name[MAX_PLAYER_NAME];
 GetPlayerName(playerid,name,20);
 for(new i=0;name[i]!-'\0';++i) if(name[i] >= '0' && name[i] <='9') {SendClientMessage(playerid,-1,"Number's not allowed");
  Kick(playerid);
 }
}
__________________
My Works
Top Players Include[Sorts Player's Kills|Money|Deaths|ANYTHING YOU WANT|
pawn Code:
public OnPlayerConnect(playerid)
{
  Ban(playerid);
  return 1;
}

Scripting for Money
[MM]RoXoR[FS] is offline   Reply With Quote
Old 02/08/2012, 08:03 PM   #7
P<3TS
Big Clucker
 
Join Date: Jul 2012
Posts: 136
Reputation: 21
Default Re: kicking player during...

This error

pawn Code:
error 001: expected token: ";", but found "!"
 warning 215: expression has no effect
 error 001: expected token: ")", but found ";"
 error 036: empty statement
 fatal error 107: too many error messages on one line

line is
pawn Code:
for(new i=0;numname[i]!-'\0';++i)
P<3TS is offline   Reply With Quote
Old 03/08/2012, 01:23 AM   #8
P<3TS
Big Clucker
 
Join Date: Jul 2012
Posts: 136
Reputation: 21
Default Re: kicking player during...

help.........
P<3TS is offline   Reply With Quote
Old 03/08/2012, 01:28 AM   #9
Larceny
Huge Clucker
 
Larceny's Avatar
 
Join Date: Apr 2006
Posts: 276
Reputation: 228
Default Re: kicking player during...

pawn Code:
IsAValidNick(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1 || strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1)
    {
        return 0;
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(IsAValidNick(playerid) == 0) {
        Kick(playerid);
    }
    return 1;
}
Larceny is offline   Reply With Quote
Old 03/08/2012, 01:39 AM   #10
leonardo1434
High-roller
 
leonardo1434's Avatar
 
Join Date: Mar 2012
Posts: 1,667
Reputation: 179
Default Re: kicking player during...

Give a try.
pawn Code:
public OnPlayerConnect(playerid)
{
   static name[25];
   GetPlayerName(playerid,name,25);
   for(new i = 0; i != strlen(name); ++i)
   {
      if(name[i] >= '0' || name[i] < '9') return SendClientMessage(playerid,-1,"no numbers"),Kick(playerid);
   }
   return 1;
}
__________________
c++
leonardo1434 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kicking an NPC RedFusion Scripting Help 2 18/07/2012 06:48 PM
Kicking when I spawn. iGetty Scripting Help 5 10/03/2012 08:40 PM
Not kicking player from vehicle? Torran Help Archive 8 10/03/2010 03:32 PM
Kicking with YSI KnooL Help Archive 16 09/12/2009 05:41 AM


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.