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



Error - Partner - 14.12.2012

I got this code:
pawn Код:
stock GetName(playerid, const name[], len)
{
    GetPlayerName(playerid, name, len);
    name[strfind(name, "_")] = ' '; // LINE 26245
    return name;
}
I get this error:
Код:
C:\Users\Yuval\Desktop\SantosCityRolePlay\gamemodes\gf.pwn(26245) : error 022: must be lvalue (non-constant)
C:\Users\Yuval\Desktop\SantosCityRolePlay\gamemodes\gf.pwn(26245) : warning 215: expression has no effect
I am trying to make a command that will replce the GetPlayerName with GetName without changing ALL my GetPlayerNames and deleting the variables. (I am editing GF). Help.


Re: Error - ikey07 - 14.12.2012

pawn Код:
stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    for(new x = 0; x < sizeof(name); x++)
    {
        if(name[x] == '_') { name[x] = ' '; }
    }
    return name;
}