Saveing players postion after logging off and RP name help
#1

Well, basically that is my issue, listed above, I can join the sever with a name such as "Jim" and it does not tell me other wise, and whenever I logg off and come back in Iam back at the spawn point, here is my script.

http://pastebin.com/ZFVjSkaJ
Reply
#2

Do you mean when you join the server you need a RP name in order to join the server, like with Firstname_LastName format?
Reply
#3

Yes, that's extaly what I mean
Reply
#4

pawn Код:
new findname = strfind(pname, "_", true);
    if(findname == -1)
    {
        hasbadname[playerid] = 1;
    }
    new findname2 = strfind(pname, "0", true);
    new findname3 = strfind(pname, "1", true);
    new findname4 = strfind(pname, "2", true);
    new findname5 = strfind(pname, "3", true);
    new findname6 = strfind(pname, "4", true);
    new findname7 = strfind(pname, "5", true);
    new findname8 = strfind(pname, "6", true);
    new findname9 = strfind(pname, "7", true);
    new findname10 = strfind(pname, "8", true);
    new findname11 = strfind(pname, "9", true);
    new findname12 = strfind(pname, "[", true);
    if(findname2 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname12 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname3 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname4 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname5 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname6 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname7 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname8 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname9 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname10 != -1)
    {
        hasbadname[playerid] = 1;
    }
    if(findname11 != -1)
    {
        hasbadname[playerid] = 1;
    }

Post it at onplayeconnect, and replace hasbadname with Kick or whatever you want,
Reply
#5

Alright here's the code:

Add this anywhere you like.
pawn Код:
stock IsValidName(playerid)
{
    if (IsPlayerConnected(playerid))
    {
        new player[24];
        GetPlayerName(playerid,player,24);
        for(new n = 0; n < strlen(player); n++)
        {
            if (player[n] == '_' && player[n+1] >= 'A' && player[n+1] <= 'Z') return 1;
            if (player[n] == ']' || player[n] == '[') return 0;
        }
    }
    return 0;
}
Then add this in the public function "OnPlayerConnect"

pawn Код:
if(!IsValidName(playerid))
    {
        SendClientMessage(playerid,COLOR_RED,"You have been kicked, reason: Invalid RolePlay Name.");
        SendClientMessage(playerid,COLOR_WHITE,"HINT: Acceptable Roleplay Name (E.G: Ethan_Crowley)");
        Kick(playerid);
    }
You may change the words, and the colors as you like.
Reply
#6

Quote:
Originally Posted by JustinAn
Посмотреть сообщение
Alright here's the code:

Add this anywhere you like.
pawn Код:
stock IsValidName(playerid)
{
    if (IsPlayerConnected(playerid))
    {
        new player[24];
        GetPlayerName(playerid,player,24);
        for(new n = 0; n < strlen(player); n++)
        {
            if (player[n] == '_' && player[n+1] >= 'A' && player[n+1] <= 'Z') return 1;
            if (player[n] == ']' || player[n] == '[') return 0;
        }
    }
    return 0;
}
Then add this in the public function "OnPlayerConnect"

pawn Код:
if(!IsValidName(playerid))
    {
        SendClientMessage(playerid,COLOR_RED,"You have been kicked, reason: Invalid RolePlay Name.");
        SendClientMessage(playerid,COLOR_WHITE,"HINT: Acceptable Roleplay Name (E.G: Ethan_Crowley)");
        Kick(playerid);
    }
You may change the words, and the colors as you like.
That shouldn't work, since it checks if the name is EQUAL to the a>z things,

You have to compare it, not make it equal to.
Reply
#7

I get this error now

Код:
C:\Users\GTW\Documents\servvevev\BaseNorton V2\gamemodes\Gamemode.pwn(204) : error 017: undefined symbol "hasbadname"
C:\Users\GTW\Documents\servvevev\BaseNorton V2\gamemodes\Gamemode.pwn(204) : warning 215: expression has no effect
C:\Users\GTW\Documents\servvevev\BaseNorton V2\gamemodes\Gamemode.pwn(204) : error 001: expected token: ";", but found "]"
C:\Users\GTW\Documents\servvevev\BaseNorton V2\gamemodes\Gamemode.pwn(204) : error 029: invalid expression, assumed zero
C:\Users\GTW\Documents\servvevev\BaseNorton V2\gamemodes\Gamemode.pwn(204) : fatal error 107: too many error messages on one line
This is line 204

Код:
hasbadname[playerid] = 1;
Reply
#8

Quote:
Originally Posted by milanosie
Посмотреть сообщение
That shouldn't work, since it checks if the name is EQUAL to the a>z things,

You have to compare it, not make it equal to.
Alright, I agree. But I prefer mines.
Reply
#9

I told you, replace hasbadname with Kick(playerid);

Its a straight copy from my own gamemode, so just use Kick




Quote:
Originally Posted by JustinAn
Посмотреть сообщение
Alright, I agree. But I prefer mines.
So you prefer a not working code above a working code?

I don't get the point of that,
Reply
#10

Well, my code works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)