SA-MP Forums Archive
Problem with mini-mode change - 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: Problem with mini-mode change (/showthread.php?tid=496466)



Problem with mini-mode change - MrTinder - 22.02.2014

Hi.I have problem with compiling this code:

pawn Код:
new ServerArea = 1;

public ChangeMode()
{
    switch(ServerArea)
    {
        case 1: ServerArea = "Deathmatch"; //Line with error
    }
    return 1;
}
error:
pawn Код:
error 006: must be assigned to an array



Re: Problem with mini-mode change - Konstantinos - 22.02.2014

You declare a variable as integer and in a public function, you're trying to set a text for it even if it's not an array.

pawn Код:
new ServerArea = 1;
new ServerAreaName[20];

public ChangeMode()
{
    switch(ServerArea)
    {
        case 1: ServerAreaName = "Deathmatch";
    }
    return 1;
}



Re: Problem with mini-mode change - LocMax - 22.02.2014

ServerArea needs to be an array,

new ServerArea[20];

Adjust the size of the array by your needs.

EDIT: Person above me was faster and more helpful >.>