randomspawn conflicting with each other...
#1

hey guys,
i have made 3 classes to my server(dealers, police, freeroam) and its working fine but now i have made randomspawns for each class but the random spawns are conflicting with each other... but the supposed to be not...
so i mean that when a player is a police class he has to spawn at lvpd or lspd or sfpd... but it isnt working.. he also spawns randomly at sfa, lsa, aa, etc...( the freeroam randomspawns)
how can i fix this?
i just want to make it that every class gets randomly spawned at their own randomspawn location...

this are my codes:
pawn Код:
new Float:RandomSpawnDealer[][] =
{
    {2822.4297,895.8810,10.7500},
    {-1010.4442,-699.1964,32.0078},
    {-2217.8198,2336.1533,7.5469}
};
new Float:RandomSpawnPolice[][] =
{
    {2264.7749,2457.4397,10.8203}, // lvpd
    {1566.5515,-1694.7217,5.8906}, // lspd
    {-1591.0151,715.4113,-5.2422} // sfpd
};
new Float:RandomSpawnFreeroam[][] =
{
    {357.75280762,2074.29980469,17.24940109}, // Randomspawn area 69
    {1601.5837,1324.1768,10.9394}, // Randomspawn lva
    {383.0134,2538.8259,16.5391}, // Randomspawn aa
    {-1389.7465,-230.8466,14.148}, // Randomspawn sfa
    {1073.1746,1267.1007,10.8281}, // Randomspawn funstunt
    {2001.8843,-2646.8259,13.7503}, // randomspawn lsa
    {-2322.072265, -1651.324707, 483.420562}, // randomspawn mc
    {2279.7246,1398.6259,42.8203} // randomspawn carpark
};
pawn Код:
AddPlayerClass(124,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(111,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(113,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(125,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(127,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(114,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(115,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(116,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(108,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // dealer
    AddPlayerClass(110,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // dealer

    AddPlayerClass(165,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(166,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(280,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(281,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(282,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(283,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(288,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(284,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(285,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
    AddPlayerClass(286,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // police
   
    AddPlayerClass(23,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(121,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(122,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(173,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(174,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(175,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(247,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(112,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(248,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
    AddPlayerClass(254,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1); // freeroam
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(Teams[playerid] == FREEROAM)
    {
        new Random = random(sizeof(RandomSpawnFreeroam));
        SetPlayerPos(playerid, RandomSpawnFreeroam[Random][0], RandomSpawnFreeroam[Random][1], RandomSpawnFreeroam[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
    if(Teams[playerid] == POLICE)
    {
        new Random = random(sizeof(RandomSpawnPolice));
        SetPlayerPos(playerid, RandomSpawnPolice[Random][0], RandomSpawnPolice[Random][1], RandomSpawnPolice[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
    if(Teams[playerid] == DEALER)
    {
        new Random = random(sizeof(RandomSpawnDealer));
        SetPlayerPos(playerid, RandomSpawnDealer[Random][0], RandomSpawnDealer[Random][1], RandomSpawnDealer[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
    neonpickup = CreatePickup(1318, 14, -2448.3794,-122.6430,26.1381, -1);
    StopAudioStreamForPlayer(playerid);
    SetWorldTime(0);
    SetPlayerToTeamColour(playerid);
    return 1;
}
pls help with this

greets niels
Reply
#2

There's something wrong with these defines or vairables:

FREEROAM, POLICE, DEALER

Make sure they have different IDs.

pawn Код:
//Example
#define FREEROAM 1
#define POLICE 2
#define DEALER 3

//Or:
new
      FREEROAM = 1,
      POLICE = 2,
      DEALER = 3
;
And use "if .. else if ... else if.. else" or "case FREEROAM: {} case POLICE: {} .." statements to stay on the safer side.
Reply
#3

pawn Код:
// classes
#define DEALER 1
#define POLICE 2
#define FREEROAM 3
#define DEALER_COLOR 0xFF9000FF // orange
#define POLICE_COLOR 0x0000FFFF // blue
#define FREEROAM_COLOR 0x00FF00FF // green
whats wrong with this? this is in my gm

EDIT: wait i think i found the problem XD brb
Reply
#4

Nevermind.

Can you try this?
pawn Код:
public OnPlayerSpawn(playerid)
{
      printf("Player(%i)'s team id: %i", Teams[playerid]); //<--- Add this line:
      //Other...


}
Now, choose different teams and spawn, check whether the team ids print out correctly.
Why I say this is because the if statement seems to reach the last one, which means the team id isn't being assigned correctly.
Reply
#5

hmm i will check.... anyway it still isnt fixed
Reply
#6

you dont set theyr teams so it cant work
Reply
#7

what you mean? i DO set the teams... i dont understand you...
Reply
#8

like gTeam[playerid] = POLICE; on class selection
Reply
#9

?? i dont understand you...
Reply
#10

look this:
pawn Код:
SetPlayerToTeamColour(playerid)
{
    if(Teams[playerid] == DEALER)
    {
        SetPlayerColor(playerid,DEALER_COLOR); //orange
        new Random = random(sizeof(RandomSpawnDealer));
        SetPlayerPos(playerid, RandomSpawnDealer[Random][0], RandomSpawnDealer[Random][1], RandomSpawnDealer[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
    if(Teams[playerid] == POLICE)
    {
        SetPlayerColor(playerid,POLICE_COLOR); // Blue
        new Random = random(sizeof(RandomSpawnPolice));
        SetPlayerPos(playerid, RandomSpawnPolice[Random][0], RandomSpawnPolice[Random][1], RandomSpawnPolice[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
    if(Teams[playerid] == FREEROAM)
    {
        SetPlayerColor(playerid,FREEROAM_COLOR); // green
        new Random = random(sizeof(RandomSpawnFreeroam));
        SetPlayerPos(playerid, RandomSpawnFreeroam[Random][0], RandomSpawnFreeroam[Random][1], RandomSpawnFreeroam[Random][2]);
        SetPlayerInterior(playerid, 0);
        SetTimerEx("Unfreeze", 2000, 0, "d", playerid);
        GameTextForPlayer(playerid,"~g~Waiting for the Objects to load",2000,3);
    }
}
and under onplayerspawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
    neonpickup = CreatePickup(1318, 14, -2448.3794,-122.6430,26.1381, -1);
    StopAudioStreamForPlayer(playerid);
    SetWorldTime(0);
    SetPlayerToTeamColour(playerid);
    return 1;
}
and onplayerrequestclass:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 2106.7463,1002.0556,45.6641);
    SetPlayerCameraPos(playerid, 2111.1670,999.0892,45.6591);
    SetPlayerCameraLookAt(playerid, 2106.7463,1002.0556,45.6641);
    SetPlayerFacingAngle(playerid, 270.1425);
    SetPlayerTeamFromClass(playerid, classid);
    switch(classid)
    {
        case 0 .. 10: { GameTextForPlayer(playerid, "~p~Dealer ~r~Class", 3000, 4); }
        case 11 .. 20: { GameTextForPlayer(playerid, "~b~Police ~r~Class", 3000, 4); }
        case 21 .. 30: { GameTextForPlayer(playerid, "~g~Freeroam ~r~Class", 3000, 4); }
    }
    return 1;
}
and this:
pawn Код:
SetPlayerTeamFromClass(playerid, classid)
{
    if(classid == 0)
    {
        Teams[playerid] = DEALER;
    }
    if(classid == 1)
    {
        Teams[playerid] = POLICE;
    }
    if(classid == 2)
    {
        Teams[playerid] = FREEROAM;
    }
}
is there something wrong wit this? then psl tell me and how to fix it...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)