Posts: 1,767
Threads: 124
Joined: Mar 2010
pawn Код:
CMD:v(playerid, params[])
{
new vehicleid, string[128];
if(sscanf(params, "d", vehicleid))return SendClientMessage(playerid, -1, "Usage: /v [vehicleid]");
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angle);
CreateVehicle(vehicleid, X, Y, Z, Angle, random(10), random(10), -1);
SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
}
return 1;
}
Anybody has a problem with it as me? Players virtual world is: 501. So basically, it should set vehicle virtual world to 501, but it doesn't. It sets to: 0, why?
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by Hansrutger
Try to make the car an object:
pawn Код:
CMD:v(playerid, params[]) { new vehicleid, string[128]; if(sscanf(params, "d", vehicleid))return SendClientMessage(playerid, -1, "Usage: /v [vehicleid]"); { new Float:X, Float:Y, Float:Z, Float:Angle, carObject; GetPlayerPos(playerid, X, Y, Z); GetPlayerFacingAngle(playerid, Angle); carObject = CreateVehicle(vehicleid, X, Y, Z, Angle, random(10), random(10), -1); SetVehicleVirtualWorld(carObject, GetPlayerVirtualWorld(playerid)); } return 1; }
For more vehicles to spawn, make sure to declare carObject as an array above in your script. Not sure if this works, I haven't really made any cars in samp yet, but it's like this objects works. Maybe it's the GetPlayerVirtualWorld part that is messing it up though. But don't see how it should. :S
|
Oh crap, I forgot that we can change vehicle virtual world to the vehicleid (returned by CreateVehicle). Silly me, huh. Thanks.