Random car spawn
#1

Sooo I have this code, and there are six posibilites of spawning in random areas. But I want it: If the place is already taken, you can't spawn there.. Any help :> ?

PHP код:
public OnPlayerSpawn(playerid)
{
    if(
pInfo[playerid][pVIP] == 1SetPlayerColor(playerid,0xFF0000);
    new 
Float:RandomSpawn[][3] =
    {
        {
3782.6897,-1919.2844,2.2270},
        {
3770.6841,-1912.3002,2.2271},
        {
3777.3240,-1914.1091,2.2271},
        {
3782.6748,-1913.8456,2.2271},
        {
3788.4456,-1914.4016,2.2271},
        {
3794.0837,-1914.7858,2.2271}
    };
    new 
rand random(sizeof(RandomSpawn));
    new 
Car CreateVehicle(411,RandomSpawn[rand][0],RandomSpawn[rand][1],RandomSpawn[rand][2],0,0,0,0);
    
PutPlayerInVehicle(playerid,Car,0);
    
SetPlayerInterior(playerid0);
    new 
pveh;
    new 
PlayerIn[MAX_PLAYER_NAME];
    for(new 
i=0;i<MAX_VEHICLES;i++)
    {
    if(
PlayerIn[i] == 0)
        {
            
pveh i;
            break;
        }
    }
    
PutPlayerInVehicle(playerid,pveh,0);
    
PlayerIn[pveh] = 1;
    return 
1;

Reply


Messages In This Thread
Random car spawn - by ValentinLaw - 18.08.2012, 20:01
Re: Random car spawn - by ikkentim - 18.08.2012, 20:09
Re: Random car spawn - by ValentinLaw - 18.08.2012, 20:13
Re: Random car spawn - by ikkentim - 18.08.2012, 20:14
Re: Random car spawn - by ValentinLaw - 18.08.2012, 20:21
Re: Random car spawn - by ikkentim - 18.08.2012, 20:33

Forum Jump:


Users browsing this thread: 1 Guest(s)