Problem spawning car at right location
#1

Hi guys.
My experience in scripting isn't so well. That's why I have this problem.

I want this vehicle to spawn here.

Код:
case 0: // Bobcat
        	    {
                     if(GetPlayerScore(playerid) < 0) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a special vehicle", "{FFED69}0 Score: Bobcat\n{FFE100}500 Score: Hotknife\n{FFC400}1000 Score: Enforcer\n{FFA200}1500 Score: Trashmaster\n{FF7700}1500 Score: Bus\n{FF3C00}2000 Score: NRG-500\n{E80000}2000 Score: Combine Harvester\n{E80074}3000 Score: Dumper\n{00FBFF}VIP: Vortex", "Purchase", "Cancel");
        	         new Float:up[3], carid;
        	         SetPlayerPos(playerid, 2904.16187, -3198.61792, 107.49332);
                     GetPlayerPos(playerid, up[0], up[1], up[2]);
                     new CurrentVeh = GetPlayerVehicleID(playerid);
                     DestroyVehicle(CurrentVeh);
                     carid = CreateVehicle(422, up[0]+2, up[1]+2, up[2], 0, -1, -1, 0);
                     LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
                     SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
                     SendClientMessage(playerid, 0x20C92EFF, "You spawned a Bobcat.");
                     PutPlayerInVehicle(playerid, carid, 0);
        	    }
But it doesn't. Because of this.

Код:
public OnPlayerSpawn(playerid)
{
   	SetPlayerPos(playerid, 2660.3000488281, -1458.6999511719, 79.400001525879);
   	SetPlayerSkin(playerid, 29);
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a special vehicle", "{FFED69}0 Score: Bobcat\n{FFE100}500 Score: Hotknife\n{FFC400}1000 Score: Enforcer\n{FFA200}1500 Score: Trashmaster\n{FF7700}1500 Score: Bus\n{FF3C00}2000 Score: NRG-500\n{E80000}2000 Score: Combine Harvester\n{E80074}3000 Score: Dumper\n{00FBFF}VIP: Vortex", "Purchase", "Cancel");
	SetPlayerSumoTime(playerid, 0);
	SetPlayerColor(playerid, 0xA8E6FFFF);
	return 1;
}
The setplayerpos is a position just for the background on the vehicle select, watching over town. But as soon as I select a vehicle, it spawns me there too. And that's fucked up.

If anyone can help me, please do so
Reply
#2

Note: OnPlayerSpawn is the vehicle select with a nice background as soon as a player hits ''Spawn'' when joined. But when a player selects a vehicle it needs to be teleported to the sumo ring. Which is this.

Код:
SetPlayerPos(playerid, 2660.3000488281, -1458.6999511719, 79.400001525879);
Reply
#3

bump ^^
Reply
#4

Okay... from what you've explained to me, this is what your code should be:
pawn Код:
case 0: // Bobcat
{
    if(GetPlayerScore(playerid) < 0) return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Choose a special vehicle", "{FFED69}0 Score: Bobcat\n{FFE100}500 Score: Hotknife\n{FFC400}1000 Score: Enforcer\n{FFA200}1500 Score: Trashmaster\n{FF7700}1500 Score: Bus\n{FF3C00}2000 Score: NRG-500\n{E80000}2000 Score: Combine Harvester\n{E80074}3000 Score: Dumper\n{00FBFF}VIP: Vortex", "Purchase", "Cancel");
    DestroyVehicle(GetPlayerVehicleID(playerid)); //Will also destroy the car if they are a passenger.
    new carid = CreateVehicle(422, 2904.16187, -3198.61792, 107.49332, 0, -1, -1, 0);
    LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid, 0x20C92EFF, "You spawned a Bobcat.");
    PutPlayerInVehicle(playerid, carid, 0);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)