Create a vehicle when player joins -
ValentinLaw - 18.08.2012
So basically I tried to make this:
When a player joins, the script creates a vehicle for him at one of these locations:
X1,X1,X1
X2,X2,X2
or
X3,X3,X3
And he joins automatically at that location in that vehicle.
Ive tried it like this, I put this onder OnGameModeInit:
PHP код:
AddStaticVehicleEx(411,3781.69995117,-1922.30004883,23.79999924,189.99755859,43,1,15);
And I have this:
PHP код:
public OnPlayerSpawn(playerid)
{
PutPlayerInVehicle(playerid, 1, 0);
return 1;
}
But yet I don't know how I can make it work ;/
Re: Create a vehicle when player joins -
RanSEE - 18.08.2012
Try this
pawn Код:
new PlayerIn[MAX_VEHICLES]; //I would replace MAX_VEHICLES with Number of vehicles you have
public OnPlayerSpawn(playerid)
{
new pveh;
for(new i=0;i<MAX_VEHICLES;i++)
{
if(!PlayerIn[i])
{
pveh = i;
break;
}
}
PutPlayerInVehicle(playerid,pveh,0);
PlayerIn[pveh] = 1;
return 1;
}
Re: Create a vehicle when player joins -
ValentinLaw - 18.08.2012
Quote:
Originally Posted by RanSEE
Try this
pawn Код:
new PlayerIn[MAX_VEHICLES]; //I would replace MAX_VEHICLES with Number of vehicles you have
public OnPlayerSpawn(playerid) { new pveh; for(new i=0;i<MAX_VEHICLES;i++) { if(!PlayerIn[i]) { pveh = i; break; } } PutPlayerInVehicle(playerid,pveh,0); PlayerIn[pveh] = 1; return 1; }
|
Could you please explain how it works, so I'll learn from it
?
Re: Create a vehicle when player joins -
ValentinLaw - 18.08.2012
By the way:
C:\Users\-\Desktop\-\gamemodes\cptv.pwn(689) : error 017: undefined symbol "PlayerIn"
C:\Users\-\Desktop\-\gamemodes\cptv.pwn(689) : warning 215: expression has no effect
C:\Users\-\Desktop\-\gamemodes\cptv.pwn(689) : error 001: expected token: ";", but found "]"
C:\Users\-\Desktop\-\gamemodes\cptv.pwn(689) : error 029: invalid expression, assumed zero
C:\Users\-\Desktop\-\gamemodes\cptv.pwn(689) : fatal error 107: too many error messages on one line
Re: Create a vehicle when player joins -
RanSEE - 18.08.2012
When Player Spawns, use one variable to create a vehicle using "CreateVehicle" and use PutPlayerOnVehicle using value 0 to change the state player to driver.