gPrisonSpawn help !
#1

Код:
new Float:gPrisonSpawns[][20] = {
{1535.6071,-1687.4871,2622.3782,},
{1531.0410,-1685.8628,2626.4785,},
{1526.4408,-1687.0918,2622.3782,},
{1526.3402,-1686.2773,2622.3782},
{1521.7162,-1686.3339,2622.3782},
{1530.7864,-1686.0039,2626.4785},
{1526.3381,-1685.8701,2626.4785},
{1521.3617,-1686.2174,2626.4785},
{1517.1804,-1686.5599,2626.4785},
{1512.1564,-1686.0719,2626.4785},
{1535.5720,-1665.2375,2622.3782},
{1531.0294,-1665.3390,2622.3782},
{1527.4852,-1663.4081,2626.0366},
{1526.3124,-1664.8875,2622.3782},
{1521.3252,-1665.5321,2622.3782},
{1534.6390,-1665.9731,2626.4785},
{1530.3339,-1666.4111,2626.4785},
{1525.2550,-1665.7960,2626.4785},
{1515.9534,-1666.4740,2626.4785},
{1520.8258,-1665.8053,2626.4785},
{1511.3445,-1666.5243,2626.4785}
};
When I /prison somebody it sends him to blueberry . Help me please.
Reply
#2

i dont understand what you're trying to say, can you explain more?
Reply
#3

Maybe you miss "Z" Coordination

It Cant me 2626 .. normal is above 25
Reply
#4

You should fix your array first!

Quote:
Originally Posted by DanBike
Посмотреть сообщение
Код:
new Float:gPrisonSpawns[][20] = {
{1535.6071,-1687.4871,2622.3782,},
{1531.0410,-1685.8628,2626.4785,},
{1526.4408,-1687.0918,2622.3782,},
{1526.3402,-1686.2773,2622.3782},
...
{1511.3445,-1666.5243,2626.4785}
};
If you want it put it like this... there are 21 rows in your code and each row has 3 elements. So fix the sizes first...
pawn Код:
new Float:gPrisonSpawns[21][3] = {
Now look at the first 3 rows which don't have proper syntax! There's an unneeded comma after the X-coordinate
pawn Код:
{1535.6071,-1687.4871,2622.3782},
{1531.0410,-1685.8628,2626.4785},
{1526.4408,-1687.0918,2622.3782},
...
Hope this helps you a little! If not, post the /prison!
Reply
#5

Код:
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3849) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3850) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3851) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3852) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3853) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(3854) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(20794) : error 032: array index out of bounds (variable "gPrisonSpawns")
C:\Documents and Settings\Liviu\My Documents\ulrp\ulrp\gamemodes\ULRP.pwn(20795) : error 032: array index out of bounds (variable "gPrisonSpawns")
After I did what you've said this is what I got.
Reply
#6

If the prison is in a int make sir you have set it in that int..
Reply
#7

The prison is not in an interior , it's mapped somewhere in the air , I guess it's not in an interior right?
Reply
#8

pawn Код:
new Float:gPrisonSpawns[21][3] =
{
{1535.6071,-1687.4871,2622.3782},
{1531.0410,-1685.8628,2626.4785},
{1526.4408,-1687.0918,2622.3782},
{1526.3402,-1686.2773,2622.3782},
{1521.7162,-1686.3339,2622.3782},
{1530.7864,-1686.0039,2626.4785},
{1526.3381,-1685.8701,2626.4785},
{1521.3617,-1686.2174,2626.4785},
{1517.1804,-1686.5599,2626.4785},
{1512.1564,-1686.0719,2626.4785},
{1535.5720,-1665.2375,2622.3782},
{1531.0294,-1665.3390,2622.3782},
{1527.4852,-1663.4081,2626.0366},
{1526.3124,-1664.8875,2622.3782},
{1521.3252,-1665.5321,2622.3782},
{1534.6390,-1665.9731,2626.4785},
{1530.3339,-1666.4111,2626.4785},
{1525.2550,-1665.7960,2626.4785},
{1515.9534,-1666.4740,2626.4785},
{1520.8258,-1665.8053,2626.4785},
{1511.3445,-1666.5243,2626.4785}
};
And show us your code where you use gPrisonSpawns.
For quick example:
pawn Код:
SetPlayerPos(playerid,gPrisonSpawns[5][0],gPrisonSpawns[5][1],gPrisonSpawns[5][2]);
Reply
#9

Код:
else if(PlayerInfo[playerid][pJailed] == 3) {
        if(!PlayerInfo[playerid][pWakeMsgSend]) {
            SendClientMessage(playerid, COLOR_PURPLE, "** You wake up in Prison **");
        }
        SetPlayerToTeamColor(playerid);
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
        IntEntered[playerid] = 0;
        rand = random(sizeof(gPrisonSpawns));
                                                  // Warp the player
        SetPlayerPos(playerid, gPrisonSpawns[rand][0],gPrisonSpawns[rand][1], gPrisonSpawns[rand][2]);
        SetPlayerPos(playerid, gPrisonSpawns[rand][3], gPrisonSpawns[rand][4], gPrisonSpawns[rand][5]);
        SetPlayerPos(playerid, gPrisonSpawns[rand][6], gPrisonSpawns[rand][7], gPrisonSpawns[rand][8]);
        SetPlayerFacingAngle(playerid, 90);
        return 1;
and

Код:
new rand;
                        BroadCast(COLOR_BLUE, string);
                        PlayerInfo[suspect][pJailTime] = time*3600;
                        format(string, sizeof(string), "You are jailed for %d hours.", PlayerInfo[suspect][pJailTime]);
                        SendClientMessage(suspect, COLOR_WHITE, string);
                        format(string,sizeof(string),"%s prisons %s for %d mins, %d bail",sendername,giveplayer,PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
                        OnPlayerDataSave(suspect);
                        CopLog(string);
                        PlayerInfo[suspect][pJailed] = 3;
                        rand = random(sizeof(gPrisonSpawns));
                                                  // Warp the player
                        SetPlayerPos(suspect, gPrisonSpawns[rand][0],gPrisonSpawns[rand][1], gPrisonSpawns[rand][2]);
                        SetPlayerPos(suspect, gPrisonSpawns[rand][3], gPrisonSpawns[rand][4], gPrisonSpawns[rand][5]);
                        SetPlayerPos(suspect, gPrisonSpawns[rand][6], gPrisonSpawns[rand][7], gPrisonSpawns[rand][8]);
Reply
#10

pawn Код:
SetPlayerPos(playerid, gPrisonSpawns[rand][0],gPrisonSpawns[rand][1], gPrisonSpawns[rand][2]);
SetPlayerPos(playerid, gPrisonSpawns[rand][3], gPrisonSpawns[rand][4], gPrisonSpawns[rand][5]);
SetPlayerPos(playerid, gPrisonSpawns[rand][6], gPrisonSpawns[rand][7], gPrisonSpawns[rand][8]);
That's the reason for your errors, the indexes can go from 0 to 2, not anything above. I don't even understand what you're trying to do teleporting the player 3 times, 2 times to an invalid location entirely.

To make the player go to a random jail, simply do:
pawn Код:
rand = random(sizeof(gPrisonSpawns));
SetPlayerPos(playerid, gPrisonSpawns[rand][0], gPrisonSpawns[rand][1], gPrisonSpawns[rand][2]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)