SA-MP Forums Archive
Problem - 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: Problem (/showthread.php?tid=347748)



Problem - Dan_Barocu - 03.06.2012

how can i make a thingy that allows a name with FirstName_LastName format..cauze i made one and it makes server restart..


Re: Problem - N0FeaR - 03.06.2012

Show us the code?


Re: Problem - Dan_Barocu - 03.06.2012

HERE:

pawn Код:
if(AntiName == 1)
                    {
                        if(namestring == -1)
                        {
                            format(string, sizeof(string),"%s, a primit Kick de la Name_BOT!",name);
                            SendClientMessageToAll(COLOR_RED, string);
                            SendClientMessage(playerid, COLOR_YELLOW, "Ministru: Nu iti putem accepta numele.");
                            SendClientMessage(playerid, COLOR_YELLOW, "Hint: Numele tau trebuie sa fie in format Nume_Prenume.");
                            format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Anticheat Has Kicked %s for Invalid Name",d,m,y,h,mi,s,name);
                            KickLog(string);
                            Kick(playerid);
                            return 1;
                        }
                    }
                    if(IsPlayerNPC(playerid))
                    {
                        SpawnPlayer(playerid);
                        return 1;
                    }

PHP код:
This -1 makes the restart if(namestring == -1) - if its 1 or 0 the server is good and doesent work.. 



Re: Problem - Edward156 - 03.06.2012

Here's one I made, by the way, it's tested and working.

pawn Код:
new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    if(strfind(pName, "_", true) == -1)
    {
        SendClientMessage(playerid,COLOR_WHITE, "Your name must be in this format: Firstname_Lastname Format. (Example: Bob_Jones)");
        Kick(playerid);
        return 1;
    }



Re: Problem - Dan_Barocu - 03.06.2012

Quote:
Originally Posted by Edward156
Посмотреть сообщение
Here's one I made, by the way, it's tested and working.

pawn Код:
new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    if(strfind(pName, "_", true) == -1)
    {
        SendClientMessage(playerid,COLOR_WHITE, "Your name must be in this format: Firstname_Lastname Format. (Example: Bob_Jones)");
        Kick(playerid);
        return 1;
    }
i put it at onplayerconnect and the server keeps restarting with no message..


Re: Problem - Edward156 - 03.06.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
i put it at onplayerconnect and the server keeps restarting with no message..
Then it's another code that's conflicting with that.


Re: Problem - Dan_Barocu - 03.06.2012

i dont know how the could the code be?


Re: Problem - Ricop522 - 03.06.2012

Show us the public OnGameModeinit


Re: Problem - Dan_Barocu - 03.06.2012

it doesent work the server is starting but no message appears..