2 RandomSpawns not working
#1

people i made a randomspawn and it is working but i tried to make another one and it didnt compile -_- look at the code

Код:
if(!strcmp(cmdtext, "/deagledm", true))
    {
	GivePlayerWeapon(playerid, 24, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /deagledm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new RandomSpawn = random(sizeof(DESpawns));
        SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3], DESpawns[RandomSpawn][4], DESpawns[RandomSpawn][5],DESpawns[RandomSpawn][6]);
        SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][7]);
        ResetPlayerWeaponsEx(playerid, 24);
        return 1;
my code in the thing up the InGameModeInIt

Код:
new Float:DESpawns[8][4] = {
    {1356.9586,2779.5247,187.3727,90.8971},
    {1356.4540,2783.1697,187.3752,89.6437},
    {1356.5916,2786.7891,187.2808,89.6437},
    {1356.3624,2790.1460,187.1783,359.6437},
    {1347.2617,2789.8162,187.1691,89.6437},
    {1346.7258,2783.3672,187.4717,177.3778},
    {1346.2091,2780.1177,187.3761,181.3787},
    {1346.5825,2785.9814,187.3735,284.5387}
};
and the errors while i compile

Код:
C:\Users\OmarSilver\Documents\samp server\gamemodes\dodo.pwn(475) : error 032: array index out of bounds (variable "DESpawns")
C:\Users\OmarSilver\Documents\samp server\gamemodes\dodo.pwn(476) : error 032: array index out of bounds (variable "DESpawns")
any help?
Reply
#2

pawn Код:
if(!strcmp(cmdtext, "/deagledm", true))
    {
    GivePlayerWeapon(playerid, 24, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /deagledm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new RandomSpawn = random(sizeof(DESpawns));
        SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3]);
        SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][7]);
        ResetPlayerWeaponsEx(playerid, 24);
        return 1;
Reply
#3

Код:
C:\Users\OmarSilver\Documents\samp server\gamemodes\dodo.pwn(476) : error 032: array index out of bounds (variable "DESpawns")
Reply
#4

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
Код:
C:\Users\OmarSilver\Documents\samp server\gamemodes\dodo.pwn(476) : error 032: array index out of bounds (variable "DESpawns")
pawn Код:
if(!strcmp(cmdtext, "/deagledm", true))
    {
    GivePlayerWeapon(playerid, 24, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /deagledm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new RandomSpawn = random(sizeof(DESpawns));
        SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3]);
        SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][4]);
        ResetPlayerWeaponsEx(playerid, 24);
        return 1;
Reply
#5

Quote:
Originally Posted by Freak@
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext, "/deagledm", true))
    {
    GivePlayerWeapon(playerid, 24, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /deagledm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new RandomSpawn = random(sizeof(DESpawns));
        SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3]);
        SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][4]);
        ResetPlayerWeaponsEx(playerid, 24);
        return 1;
lollololololol it is

Код:
SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][3]);
just correcting XD
Reply
#6

Change:
pawn Код:
new Float:DESpawns[8][4] = {
To this:
pawn Код:
new Float:DESpawns[9][5] = {
Reply
#7

all i did is this

Код:
new Float:DESpawns[8][4] = {
    {1356.9586,2779.5247,187.3727,90.8971},
    {1356.4540,2783.1697,187.3752,89.6437},
    {1356.5916,2786.7891,187.2808,89.6437},
    {1356.3624,2790.1460,187.1783,359.6437},
    {1347.2617,2789.8162,187.1691,89.6437},
    {1346.7258,2783.3672,187.4717,177.3778},
    {1346.2091,2780.1177,187.3761,181.3787},
    {1346.5825,2785.9814,187.3735,284.5387}
};
then

Код:
if(!strcmp(cmdtext, "/deagledm", true))
    {
	GivePlayerWeapon(playerid, 24, 50000000);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /deagledm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new RandomSpawn = random(sizeof(DESpawns));
        SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3]);
        SetPlayerFacingAngle(playerid, DESpawns[RandomSpawn][3]);
        ResetPlayerWeaponsEx(playerid, 24);
and it is working with no errors and i tried in game and also working! the random spawn is working
Reply
#8

Lol, first of all, change:
(I would assume you are getting a warning saying "Number of arguments do not match definition"?)
pawn Код:
SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2], DESpawns[RandomSpawn][3]);
To:
pawn Код:
SetPlayerPos(playerid, DESpawns[RandomSpawn][0], DESpawns[RandomSpawn][1], DESpawns[RandomSpawn][2]);
Reply
#9

i got 7 warnings already bro -_- FUCK THEM THE IMPORTANT THING IT WORKS XD and btw i made a hydra dm
the random spawns are not working! help?

Код:
new Float:HydraSpawns[2][4] = {
    {-972.9755,1069.8314,1345.0050,85.8408},
    {-1134.6814,1049.0612,1345.7662,270.3724}
};
then

Код:
SetPlayerInterior(playerid, 10);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /hydra dm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new Random = random(sizeof(HydraSpawns));
        SetPlayerPos(playerid, HydraSpawns[Random][0]);
        SetPlayerFacingAngle(playerid, HydraSpawns[Random][1]);
it compiles but -.- when i go in game i type i t then unknown command then again it worked and it teleported me to a weird place that i didnt want and it keeps saying unknown then works to type the command but not the teleport -.- ANY HELP?
Reply
#10

Quote:
Originally Posted by SilverKiller
Посмотреть сообщение
i got 7 warnings already bro -_- FUCK THEM THE IMPORTANT THING IT WORKS XD and btw i made a hydra dm
the random spawns are not working! help?

Код:
new Float:HydraSpawns[2][4] = {
    {-972.9755,1069.8314,1345.0050,85.8408},
    {-1134.6814,1049.0612,1345.7662,270.3724}
};
then

Код:
SetPlayerInterior(playerid, 10);
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        format(str, 128, "%s has teleported to /hydra dm", pName);
        SendClientMessageToAll(0xFF9900AA, str);
        new Random = random(sizeof(HydraSpawns));
        SetPlayerPos(playerid, HydraSpawns[Random][0]);
        SetPlayerFacingAngle(playerid, HydraSpawns[Random][1]);
it compiles but -.- when i go in game i type i t then unknown command then again it worked and it teleported me to a weird place that i didnt want and it keeps saying unknown then works to type the command but not the teleport -.- ANY HELP?
Lol... I can see why you are getting so many warnings. I have PM'ed you about using teamviewer to fix this for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)