SA-MP Forums Archive
Spawning a Modified Vehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Spawning a Modified Vehicle (/showthread.php?tid=138789)



Spawning a Modified Vehicle - keujh - 03.04.2010

Alrighty. let's get down and dirty.

Here's the code.

pawn Код:
//Modified Jester (Admin Vehicle)
public OnVehicleSpawn(vehicleid)
{
  if (vehicleid == vehicle)
  {  //============================[Jester]================================//
    AddVehicleComponent(vehicle, 1010); // Nitro
    AddVehicleComponent(vehicle, 1065); // Exhaust Alien
    AddVehicleComponent(vehicle, 1067); // Roof Alien
    AddVehicleComponent(vehicle, 1069); // SideskirtRight Alien Sideskirt
    AddVehicleComponent(vehicle, 1071); // SideskirtLeft Alien Sideskirt
    AddVehicleComponent(vehicle, 1073); // Shadow Rims
    AddVehicleComponent(vehicle, 1158); // Spoiler X-Flow
    AddVehicleComponent(vehicle, 1159); // Rearbumper Alien
    AddVehicleComponent(vehicle, 1160); // Frontbumper Alien
    AddVehicleComponent(vehicle, 1013); // Head lights
  }
  return 1;
}

//Spawn Command (EPIC FAIL)
if(strcmp(cmdtext, "/gjester", true) == 0)
{
     if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
     else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
     // (Bad, IGNORE) // == vehicle = AddStaticVehicle(559,-2482.4937,2242.3936,4.6225,179.3656,6,1); // ==

         return 1;
    }
return 0;
}
What i am trying to do is have a modified jester spawned right infront of you. providing that you are logged into RCON. I know how to do it at a certain location by using addstaticvehicle but i want to make it so that it spawns infront of me, when i type /gjester. anyways i hope someone can help me with this.

Best of luck,
Keujh



Re: Spawning a Modified Vehicle - boelie - 15.05.2010

Hmm..do you want it to be spawned directly under playerspawn ? cuz using a command wich only rcon admins can use is easyer.

[EDIT]..i tried adding components under one command and nothing happend so im not sure if its possible
to have many components scripted under eachother like you did in your example.
I think the first component would work and pwno skips the rest.



Re: Spawning a Modified Vehicle - Thrarod - 15.05.2010

if(strcmp(cmdtext, "/gjester", true) == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
vehicle = CreateVehicle(559,x,y,z,179.3656,6,1,6000000);
PutPlayerInVehicle(playerid, vehicle, 0);
return 1;
}


Re: Spawning a Modified Vehicle - Zh3r0 - 15.05.2010

Quote:
Originally Posted by Thrarod
if(strcmp(cmdtext, "/gjester", true) == 0)
{
new Float, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
vehicle = CreateVehicle(559,x,y,z,179.3656,6,1,6000000);
PutPlayerInVehicle(playerid, vehicle, 0);

return 1;
}
He said IN FRONT, not over him...
pawn Код:
if(strcmp(cmdtext, "/gjester", true) == 0)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if(IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_WHITE, "Vehicle Spawned!");
    else SendClientMessage(playerid, COLOR_RED, "You must be logged into RCON to use this command.");
    vehicle = CreateVehicle(559,x+4,y+1,z+3,179.3656,6,1,6000000);
    PutPlayerInVehicle(playerid, vehicle, 0);
     AddVehicleComponent(vehicle, 1010); // Nitro
     AddVehicleComponent(vehicle, 1065); // Exhaust Alien
     AddVehicleComponent(vehicle, 1067); // Roof Alien
     AddVehicleComponent(vehicle, 1069); // SideskirtRight Alien Sideskirt
     AddVehicleComponent(vehicle, 1071); // SideskirtLeft Alien Sideskirt
     AddVehicleComponent(vehicle, 1073); // Shadow Rims
     AddVehicleComponent(vehicle, 1158); // Spoiler X-Flow
     AddVehicleComponent(vehicle, 1159); // Rearbumper Alien
     AddVehicleComponent(vehicle, 1160); // Frontbumper Alien
     AddVehicleComponent(vehicle, 1013); // Head lights
    return 1;
}
Also, you didn add the components


Re: Spawning a Modified Vehicle - Thrarod - 15.05.2010

It should add when you spawn it... Dont see onvehiclespawn part?


Re: Spawning a Modified Vehicle - Zh3r0 - 15.05.2010

Quote:
Originally Posted by Thrarod
It should add when you spawn it... Dont see onvehiclespawn part?
Tbh, never checked what actually OnVehicleSpawn does

My bad.


Re: Spawning a Modified Vehicle - Killa_ - 15.05.2010

Any1 will be able to use that command.


Re: Spawning a Modified Vehicle - Thrarod - 15.05.2010

Nope, I tested it and It only worked on RCOn but it didn't add comps to the car even theyre in OVS callback :S


Re: Spawning a Modified Vehicle - Zh3r0 - 15.05.2010

Quote:
Originally Posted by Thrarod
Nope, I tested it and It only worked on RCOn but it didn't add comps to the car even theyre in OVS callback :S
Then it's better to add components inside the command?


Re: Spawning a Modified Vehicle - Thrarod - 15.05.2010

I think so but why it didn't add :S