Change name help
#1

I'm making RPG GM and i working on /changename command i use djson for write/load data and ycmd for command processor

My command shoud be like /changename [playerid] [new name]
but if that 'new name' already exist it will not change name for 'playerid'

this is my command:

pawn Код:
YCMD:changename(playerid,params[],help)
{
    #pragma unused help
    new
       id,
       name[MAX_PLAYER_NAME],
       string[2][128],
       iData[64];

    if(PlayerInfo[playerid][pAdmin] < 3) return SCM(playerid,""#hex_siva"Moras biti administrator kako bi mogao koristiti ovu komandu!",""#hex_siva"Just administrators can use that command.");
    else if(sscanf(params,"us[MAX_PLAYER_NAME]",id,name)) return SCM(playerid, ""#hex_siva"KORISTI: /changename [ID] [Novo Ime]", ""#hex_siva"USAGE: /changename [ID] [New Name]");
    else if(id == INVALID_PLAYER_ID) return SCM(playerid,""#hex_siva"SERVER: Igrac nije online.",""#hex_siva"SERVER: Player with that ID is offline.");
    else
    {
        format(iData, sizeof iData, SERVER_DATA, GetName(id));
       
        if(strcmp(iData, name, true)
        {
       
        }
    }
    return true;
}
Can someone help me about that part of job?
Reply
#2

Well if you look at https://sampwiki.blast.hk/wiki/SetPlayerName it returns -1 if the name is already in use.. so you could do if(SetPlayerName(playerid, "Name") == -1)
Reply
#3

But that check just for 'online' players. I need to check my data base
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)