/changename command

I need changename command which can be done only by admins level 3 please someone give me

Check this topic out: https://sampforum.blast.hk/showthread.php?tid=325287 or https://sampforum.blast.hk/showthread.php?tid=327076

Also, be sure to use the 'Search' feature before asking.

I have checked these but these are not working

Youse use DINI or y_ini ?

I use Y_ini

Pls can any one give me whole .pwn ? of change name and pls tell me what to add on the top of script

i was using this

#include <a_samp>
#include <zcmd>

CMD:changename(playerid, params[])
new targetid,name[128];
if(PInfo[playerid][Level] < 2 || !IsPlayerAdmin(playerid)) return 0;
else if (sscanf(params,"us",targetid,name))SendClientMessa ge(playerid,RED,"Usage: /changename [Playerid] [New name]");
else if(!IsPlayerConnected(targetid))SendClientMessage( playerid,RED,"Error: Player is not connected!");
else {
new string[128],n[MAX_PLAYER_NAME];
format(string,sizeof(string),"Admin %s [ID:%d] Has set %s [ID:%d] name to %s",Name(playerid),playerid,n,targetid,name);
format(string,sizeof(string),"Your Name has been set to %s by Admin %s[ID:%d]",Name(targetid),n,playerid);
return 1;

This is mine, you'd have to edit it to suit your system though:
pawn Code:
CMD:setname(playerid, params[])
    if(PlayerData[playerid][AdminLevel] < 4) return SendUnathorizedMessage(playerid);
    new target, string[126], oldname[126], newname[126], newname2[126];
    if(sscanf(params, "us[126]", target, newname)) return SendClientMessage(playerid, C_SYNTAX, "Syntax:{FFFFFF} /setname [player id/part of name] [new name]");
    if(gIsPlayerLoggedIn[playerid] == 0) return SendPlayerNotSpawnedMessage(playerid);
    format(string, sizeof(string), "/accounts/%s.ini", newname);
    if(fexist(string)) return SendClientMessage(playerid, C_SYNTAX, "Error:{FFFFFF} That user-account already exists.");

    format(oldname, sizeof(oldname), "%s", GetPlayersName(target));
    SetPlayerName(target, newname);
    format(newname2, sizeof(newname2), "%s", RemoveUnderScore(target));
    for(new i = 1; i < sizeof(HouseData); i++) {
        if(strcmp(oldname, HouseData[i][Owner], true) == 0)
            strmid(HouseData[i][Owner], newname2, 0, strlen(newname2), 255);
    for(new i = 1; i < sizeof(BusinessInfo); i++) {
        if(strcmp(oldname, BusinessInfo[i][Owner], true) == 0)
            strmid(BusinessInfo[i][Owner], newname2, 0, strlen(newname2), 255);
    yinifrename(oldname, newname2);
    format(string, sizeof(string), "* An admin changed your name from %s to %s", oldname, newname2);
    SendClientMessage(target, C_CYAN, string);
    format(string, sizeof(string), "* You changed %s's name to %s.", oldname, newname2);
    SendClientMessage(playerid, C_CYAN, string);
    format(string, sizeof(string), "/accounts/%s.ini", oldname);
    return 1;

stock yinifrename(oldname[], newname[])
    if(!fexist(oldname)) return 1;
    new string[128], File:older, File:newer;
    older = fopen(oldname, io_read);
    newer = fopen(newname, io_write);
    while(fread(older, string))
        format(string, sizeof(string), "%s\r\n", string);
        fwrite(newer, string);
    return 1;

pawn Code:
CMD:setname(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
        new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, 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,red,"ERROR: Incorrect Name Length");
        if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,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,blue,string);
            if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your name to \"%s\" ", pName(playerid), tmp2); SendClientMessage(player1,blue,string); }
            PlayerInfo[playerid][God] = 0;
            SetPlayerHealth(player1, 100);
            SetPlayerName(player1, tmp2);
            return OnPlayerConnect(player1);
        } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    } else return SendClientMessage(playerid,red,"ERROR: Server Unknown Command.");

Team Pro These erros coming
D:\TDm 2.0\TAXI\filterscripts\changename.pwn(7) : error 029: invalid expression, assumed zero
D:\TDm 2.0\TAXI\filterscripts\changename.pwn(7) : error 017: undefined symbol "cmd_setname"
D:\TDm 2.0\TAXI\filterscripts\changename.pwn(7) : error 029: invalid expression, assumed zero
D:\TDm 2.0\TAXI\filterscripts\changename.pwn(7) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

Forum Jump:

Users browsing this thread: