SA-MP Forums Archive
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: Problem (/showthread.php?tid=335974)



Problem - sniperwars - 20.04.2012

Hey,

I have a problem with my command which is /setname:

pawn Код:
dcmd_setname(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
        new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "[USAGE]: /setname [playerid] [new name]");
        new player1 = strval(tmp), length = strlen(tmp2), string[128];
        if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid, COLOR_RED,"[ERROR]: Incorrect Name Length");
        if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(player1), tmp2); SendClientMessage(playerid,COLOR_ORANGE,string);
            if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your name to \"%s\" ", pName(playerid), tmp2); SendClientMessage(player1, COLOR_BLUE, string); }
            SetPlayerName(player1, tmp2);
            return OnPlayerConnect(player1);
        } else return SendClientMessage(playerid, COLOR_RED,"[ERROR]: Player is not connected");
    } else return SendClientMessage(playerid, COLOR_RED,"[ERROR]: You are not a high enough level to use this command");
}
When I set a players name, they relog with the new name and the name doesn't exist. Basically like a temporary name change. Can anyone make this a permanent name change by changing the current name of the .ini file created ?

Regards,

Sean aka sniperwars


Re: Problem - ViniBorn - 20.04.2012

Change tha name of archive


Re: Problem - sniperwars - 20.04.2012

Do I really want to do that ? I don't have time to visit the Volt-Host panel and change of a 100 hundred accounts names. Is there any other way of doing it ?


Re: Problem - ViniBorn - 20.04.2012

What's your file system?


Re: Problem - sniperwars - 20.04.2012

Each account saves as an .ini file.


Re: Problem - sniperwars - 20.04.2012

Anyone ?

I really need this command fixed like now :/


Re: Problem - ViniBorn - 20.04.2012

You use Dini, y_ini ,etc ?


Re: Problem - sniperwars - 20.04.2012

The plugin is dudb.


Re: Problem - Rudy_ - 20.04.2012

use Zcmd better
pawn Код:
CMD:setname(playerid,params[])
{
    if(Info[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        new id, name[24], str[130], newname;
        if(sscanf(params, "udd", id,name,newname)) return SendClientMessage(playerid,red,"/SetName [Playerid/Name] [New Name]");
        GetPlayerName(id,name,24);
        format(str,130,"You Changed %s (%d)'s Name to $%d",name,id,newname);
        SendClientMessage(playerid,lightblue,str);
        format(str,130, "Admin Changed Your Name to $%d",newname);
        SendClientMessage(playerid,lightblue,str);
        SetPlayerName(id,name);
    } else return SendClientMessage(playerid,red,"You are not Authorized to use this command");
    return 1;
}



Re: Problem - MadeMan - 20.04.2012

Show the code that saves/loads user info from .ini file.