SA-MP Forums Archive
Is this right? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is this right? (/showthread.php?tid=182395)



Is this right? - Luis- - 10.10.2010

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;
    }



Re: Is this right? - DarrenReeder - 10.10.2010

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,


Re: Is this right? - LarzI - 10.10.2010

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;
    }



Re: Is this right? - Luis- - 10.10.2010

Thanks, It now works!


Re: Is this right? - DarrenReeder - 10.10.2010

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