SA-MP Forums Archive
weird errors :S - 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: weird errors :S (/showthread.php?tid=246348)



weird errors :S - tanush - 03.04.2011

im trying to make player will spawn at those x y z at OnPlayerSpawn but i got errors
pawn Код:
D:\Users\Tanush\Desktop\SA-MP\gamemodes\stunt.pwn(77) : error 018: initialization data exceeds declared size
D:\Users\Tanush\Desktop\SA-MP\gamemodes\stunt.pwn(1165) : error 032: array index out of bounds (variable "spawn")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
pawn Код:
new Float:spawn[][2] =
{
    {404.1312,2452.7603,16.5000},
    {1852.3341,-2547.9702,13.5469}
};
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    new ran = random(sizeof(spawn));//This funtion "random(max)" will give a random number of what is put there.
    SetPlayerPos(playerid,spawn[ran][0],spawn[ran][1],spawn[ran][2]);
    SetPlayerFacingAngle(playerid,357.2612);
    return 1;
}
first error line
pawn Код:
{
second error line
pawn Код:
SetPlayerPos(playerid,spawn[ran][0],spawn[ran][1],spawn[ran][2]);



Re: weird errors :S - Marricio - 03.04.2011

try

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,spawn[0],spawn[1],spawn[2]);
    SetPlayerFacingAngle(playerid,357.2612);
    return 1;
}



Re: weird errors :S - ~Yoshi - 03.04.2011

edit: Marricio was earlier, wups


Re: weird errors :S - tanush - 03.04.2011

pawn Код:
D:\Users\Tanush\Desktop\SA-MP\gamemodes\stunt.pwn(70) : error 018: initialization data exceeds declared size
D:\Users\Tanush\Desktop\SA-MP\gamemodes\stunt.pwn(1164) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
first error line
pawn Код:
{404.1312,2452.7603,16.5000},
second error line
pawn Код:
SetPlayerPos(playerid,spawn[0],spawn[1],spawn[2]);



Re: weird errors :S - airsoft - 04.04.2011

pawn Код:
new Float:spawn[][3] =
{
    {404.1312,2452.7603,16.5000},
    {1852.3341,-2547.9702,13.5469}
}
There ya go. [2] should be [3]


Re: weird errors :S - tanush - 04.04.2011

EDIT: I ALREADY FIXED IT ... airsoft help me for 3 and i fixed the other errors