SA-MP Forums Archive
RP Game Mode 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: RP Game Mode problem (/showthread.php?tid=608798)



RP Game Mode problem - Micko123 - 05.06.2016

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


Re: RP Game Mode problem - BornHuman - 05.06.2016

Show us the code please!


Re: RP Game Mode problem - Micko123 - 05.06.2016

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;




Re: RP Game Mode problem - BornHuman - 05.06.2016

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).


Re: RP Game Mode problem - Micko123 - 05.06.2016

How??


Re: RP Game Mode problem - BornHuman - 05.06.2016

Are you using Y_INI or dini?


Re: RP Game Mode problem - Micko123 - 05.06.2016

y_ini


Re: RP Game Mode problem - BornHuman - 05.06.2016

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?


Re: RP Game Mode problem - Micko123 - 05.06.2016

nope


Re: RP Game Mode problem - BornHuman - 05.06.2016

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