RP Game Mode problem
#1

Hey guys. So i made this /changename command. It changes name and it makes new file in script files. But there is problem.
Because this is RP gamemode if i login as Micko_Black everything is good. But if i change my name to Micko and try to login again it will kick me because name is not acceptable.
Can you tell me how can i fix this?? Thank you
Reply
#2

Show us the code please!
Reply
#3

this is CMD for changing name
PHP код:
YCMD:changename(playeridparams[], help)
{
    
#pragma unused help
    
new targetid,name[128];
    if(
PlayerInfo[playerid][pAdmin] >=6)
    {
        if(
sscanf(params,"us",targetid,name))
        {
            
SendClientMessage(playerid,0xFF0000FF,"Usage: /changename [Playerid] [New name]");
            return 
1;
        }
        if(!
IsPlayerConnected(targetid))
        {
            
SendClientMessage(playerid,0xFF0000FF,"Error: Player is not connected!");
            return 
1;
        }
        else
        {
            new 
string[128],n[MAX_PLAYER_NAME];
            
GetPlayerName(targetid,n,sizeof(n));
            
SetPlayerName(targetid,name);
            
format(string,sizeof(string),"Admin %s [ID:%d] je promijenio %s [ID:%d] ime na %s",GetName(playerid),playerid,n,targetid,name);
            
SendClientMessageToAll(0xF3FF02,string);
              
format(string,sizeof(string),"Vase ime je promijenjeno na %s od strane Admina %s[ID:%d]",GetName(targetid),n,playerid);
            
SendClientMessage(playerid,0x6EF83C,string);
        }
    }
    return 
1;

Reply
#4

Quote:
Originally Posted by Micko123
Посмотреть сообщение
this is CMD for changing name
PHP код:
YCMD:changename(playeridparams[], help)
{
    
#pragma unused help
    
new targetid,name[128];
    if(
PlayerInfo[playerid][pAdmin] >=6)
    {
        if(
sscanf(params,"us",targetid,name))
        {
            
SendClientMessage(playerid,0xFF0000FF,"Usage: /changename [Playerid] [New name]");
            return 
1;
        }
        if(!
IsPlayerConnected(targetid))
        {
            
SendClientMessage(playerid,0xFF0000FF,"Error: Player is not connected!");
            return 
1;
        }
        else
        {
            new 
string[128],n[MAX_PLAYER_NAME];
            
GetPlayerName(targetid,n,sizeof(n));
            
SetPlayerName(targetid,name);
            
format(string,sizeof(string),"Admin %s [ID:%d] je promijenio %s [ID:%d] ime na %s",GetName(playerid),playerid,n,targetid,name);
            
SendClientMessageToAll(0xF3FF02,string);
              
format(string,sizeof(string),"Vase ime je promijenjeno na %s od strane Admina %s[ID:%d]",GetName(targetid),n,playerid);
            
SendClientMessage(playerid,0x6EF83C,string);
        }
    }
    return 
1;

I'm not sure what ini file system you're using, but just change the name of the file to the new username.

Edit: As for the kicking because you're name isn't roleplay, make it check if the name is roleplay only when the account doesn't exist. (i.e when the player has to register). Don't check for the roleplay name if the account is already registered (i.e when the player has to login).
Reply
#5

How??
Reply
#6

Are you using Y_INI or dini?
Reply
#7

y_ini
Reply
#8

Quote:
Originally Posted by Micko123
Посмотреть сообщение
y_ini
Here's a tutorial I found that seems to be exactly what you're looking for: https://sampforum.blast.hk/showthread.php?tid=397180

Do you know what I mean with the roleplay account check?
Reply
#9

nope
Reply
#10

Quote:
Originally Posted by Micko123
Посмотреть сообщение
not exacly
Can you show me the code for when a player is prompted to either login or register?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)