Code won't work
#1

Hello I'm trying to block a name (of a few) from connecting to my server because it freezes my server and i tried this code but I get errors and idk how to fix them.

Код:
   public OnPlayerConnect(playerid)
   {
       new pName[MAX_PLAYER_NAME];
       GetPlayerName(playerid,pName,sizeof(pName);//probably messed that up bad
       if(pName == "con"){
       Kick(playerid);
       }
       //rest of player connect
       return 1;
}
Errors:

Quote:

C:\Users\Alex\Desktop\HydraX\Stunt Paradise 0.3a\pawno\include\cps.inc(140) : warning 208: function with tag result used before definition, forcing reparse
C:\Users\Alex\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(1021) : error 027: invalid character constant
C:\Users\Alex\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(1021) : error 017: undefined symbol "on"
C:\Users\Alex\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(1021 -- 1022) : error 029: invalid expression, assumed zero
C:\Users\Alex\Desktop\Stunt Paradise 0.3a\gamemodes\SP.pwn(1021 -- 1022) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Reply
#2

Check the sa:mp wiki and search for strcmp function (you can use it to compare two strings) and also check PAWN basics.
Reply
#3

Quote:
Originally Posted by Don Correlli
Check the sa:mp wiki and search for strcmp function (you can use it to compare two strings) and also check PAWN basics.
I need someone to fix it for me.
Reply
#4

Код:
   public OnPlayerConnect(playerid)
   {
       new pName[MAX_PLAYER_NAME];
       GetPlayerName(playerid,pName,sizeof(pName));//probably messed that up bad
       if(strcmp(pName,"con",true)) Kick(playerid);
       //rest of player connect
       return 1;
}
Reply
#5

Quote:
Originally Posted by CJ101
Код:
   public OnPlayerConnect(playerid)
   {
       new pName[MAX_PLAYER_NAME];
       GetPlayerName(playerid,pName,sizeof(pName));//probably messed that up bad
       if(strcmp(pName,"con",true)) Kick(playerid);
       //rest of player connect
       return 1;
}
Thanks but I'm getting errors can you add it for me in my GM? Here's the GM.. http://pastebin.com/3MdM4rmU
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)