26.07.2010, 19:52
Hi,
is it possible to spawn a train via a command? Or just with AddStaticVehicleEx?
Thanks in advance
is it possible to spawn a train via a command? Or just with AddStaticVehicleEx?
Thanks in advance
dcmd_vehicle(playerid,params[])
{
new carid,car;
if(!PlayerInfo[playerid][admin]) return 0;
if(sscanf(params,"i",carid))
{
SendClientMessage(playerid,0x00AA00AA,"[!] Usage: /vehicle (car id #)");
}
else
{
new str[256],Float:x,Float:y,Float:z,Float:a;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,a);
if(carid==537 || carid==538)//if its a train, use AddStaticVehicleEx
{
new train;
train = AddStaticVehicleEx(carid,x,y,z,a,-1,-1,10000000000000000);
PutPlayerInVehicle(playerid,train,0);
}
else
{
car = CreateVehicle(carid,x,y,z,a,-1,-1,10000000000000);
PutPlayerInVehicle(playerid,car,0);
}
format(str,sizeof(str),"[!] Vehicle #%d spawned",carid);
SendClientMessage(playerid,0x00AAAAAA,str);
}
return 1;
}