id 0 name
#1

Can someone explain me why this command to change name in the message it says the name of the player id 0?

pawn Код:
CMD:cname(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] >= 2)
    {
    new targetPlayer, newName[MAX_PLAYER_NAME];
    new pname[24];
    if(sscanf(params, "us[24]", targetPlayer, newName)) return SCM(playerid,-1, "{F70505}Usage: {FFFFFF}/cname <playerid> <new name>");

    if(!IsPlayerConnected(targetPlayer))
    {
        return SendClientMessage(playerid, red, "Invalid playerid.");
    }

    new clientMessage[128];
    GetPlayerName(targetPlayer,pname,sizeof(pname));

    format(clientMessage, sizeof(clientMessage), "UPDATE `playerdata` SET `user` = '%s' WHERE `user` = '%s'", sanitize(newName), GetPlayersName(targetPlayer));
    mysql_function_query(mysqlc, clientMessage, false, "", "");

    SetPlayerName(targetPlayer, "TEMP_CNAME");
    SetPlayerName(targetPlayer, newName);
   
    new pstring[128];
    format(pstring,sizeof(pstring),"%s (lvl %d) %s (%d) changed %s (%d)'s account name to %s.",AdminLevelToName(playerid),PlayerInfo[playerid][Admin],GetPlayersName(playerid),playerid,pname,targetPlayer,newName);
    SendStaffMessage(pink,pstring);
    new k[128];
    format(k, sizeof(k), "1,8%s (lvl %d) %s (%d) changed %s (%d)'s account name to %s.",AdminLevelToName(playerid),PlayerInfo[playerid][Admin],GetPlayersName(playerid),playerid,pname,targetPlayer,newName);
    IRC_GroupSay(gGroupID, IRC_ACHANNEL, k);
    }
    return 1;
}
Here:
pawn Код:
changed %s (%d)'s account name to %s.
At "changed %s (%d)" im getting the name of the player id 0, even if the target player has another id.
Reply


Messages In This Thread
id 0 name - by Face9000 - 04.02.2014, 18:02
Re: id 0 name - by Admigo - 04.02.2014, 19:10
Re: id 0 name - by PowerPC603 - 04.02.2014, 19:38
Re: id 0 name - by Face9000 - 04.02.2014, 19:55
Re: id 0 name - by Threshold - 04.02.2014, 21:53
Re: id 0 name - by Face9000 - 05.02.2014, 09:45

Forum Jump:


Users browsing this thread: 1 Guest(s)