weird errors :S
#1

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]);
Reply
#2

try

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

edit: Marricio was earlier, wups
Reply
#4

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]);
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)