Is this right?
#1

pawn Код:
if(!strcmp("/changename", cmdtext, true, 11))
    {
        if(!cmdtext[11])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /changename [name]");
        new str[128];
        new getplayer[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "[Name Change] %s Has change his name to %d", playerid, str);
        SendClientMessageToAll(COLOR_ALERT, str);
        SetPlayerName(playerid, getplayer);
        return 1;
    }
Reply
#2

I dont think it is, but not too sure...

However, It doesnt matter because the one thing i would recommend to you is to look up SScanf and Zcmd:

https://sampwiki.blast.hk/wiki/Fast_Commands

Its all there,
Reply
#3

No this won't work.. You almost got it though.
Try this:

pawn Код:
if(!strcmp("/changename", cmdtext, true))
    {
        if(!cmdtext[11] || (cmdtext[11] == '\1' && !cmdtext[12]))return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /changename [name]");
        new str[128];
        SetPlayerName(playerid, cmdtext[12]);
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "[Name Change] %s(ID:%d) Has change his name to %s", str, playerid, cmdtext[12]);
        SendClientMessageToAll(COLOR_ALERT, str);
        return 1;
    }
Reply
#4

Thanks, It now works!
Reply
#5

I still recommend You look at sscanf and zcmd, its a lot faster (and easier to script)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)