SA-MP Forums Archive
Array problem, Please help. - 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: Array problem, Please help. (/showthread.php?tid=446850)



Array problem, Please help. - nike96 - 27.06.2013

I understand this...
error 006: must be assigned to an array
in sname[ID] = name; and sstring[ID] = string;
global variable: new sname[MAX_PLAYERS], sstring[MAX_PLAYERS];

PHP код:
CMD:zinute(playerid,params[])
{
    new 
string[128], IDname[MAX_PLAYER_NAME];
    if(
sscanf(params,"uz",ID,string)) return InfoBoxForPlayer(playerid,"~r~/zinute [ID] [Text]");
    
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
         
sname[ID] = name;
    
sstring[ID] = string;
        return 
1;




Re: Array problem, Please help. - nike96 - 27.06.2013

anybody can help me?


Re: Array problem, Please help. - SuperViper - 27.06.2013

You can't assign string values like that, you must use format.

pawn Код:
format(sname[ID], MAX_PLAYER_NAME, name);



Re: Array problem, Please help. - nike96 - 27.06.2013

I fixed it, i change global variable to new sname[30][MAX_PLAYERS], sstring[128][MAX_PLAYERS]; but ty