SA-MP Forums Archive
Car spawner...[SOLVED!! XD THANX FOR ALL UR HELP! XD) - 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: Car spawner...[SOLVED!! XD THANX FOR ALL UR HELP! XD) (/showthread.php?tid=92269)



Car spawner...[SOLVED!! XD THANX FOR ALL UR HELP! XD) - arie9000nerd - 19.08.2009

SOLVED!! SOLVED!! TYHANX!!!!


THANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANX THANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANX THANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANX THANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANXTHANX THANXTHANXTHANXTHANX 1000000 times thanx!


Re: Car spawner... - Eazy_Efolife - 19.08.2009

Line?


Re: Car spawner... - arie9000nerd - 19.08.2009

Quote:
Originally Posted by Compton's Eazy E
Line?
i mean in one line in my script...

help please!! XD thanx :P


Re: Car spawner... - Hei2 - 19.08.2009

He wants you to post the line of code you have the errors on so we can help you fix it without doing all the work for you.


Re: Car spawner... - saiberfun - 19.08.2009

Quote:
Originally Posted by arie9000nerd
Hi!
i got a server.... a stunt server.... but my players always got a question if there is an option to spawn a car....
so, i tryed to make an script...to spawn a car if u typ: /nrg....
BUT I GOT 9 ERRORS IN ONE LINE!! I can't script......
can somebody help me making a simple script with a command: /nrg and then you get an nrg?
thanx! XD
oh, and btw, sory for my bad english....:P
pawn Код:
if (strcmp("/nrg", cmdtext, true, 10) == 0)
    {
        new Float:x,Float:y,Float:z,Float:a;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid,a);
        AddStaticVehicle(522,x+2,y,z,a,1,1);
        SendClientMessage(playerid,0x21DD00FF,"You spawned a NRG-500");
        return 1;
    }



Re: Car spawner... - Augustinas - 19.08.2009

first you need to create a function that spawns a car for you (this is the shortest way).

Add this in the end of your script:
pawn Код:
SpawnVehicle(playerid, vehicleid)
{
  new Float:X, Float:Y, Float:Z, Float:A; //Stores your position and Angle
  new Vehicle;
  GetPlayerPos(playerid, X, Y, Z); //Gets your Position
  GetPlayerFacingAngle(playerid, A); //Gets your Angle

  if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xF60000AA, "You have to be on foot to use this command!");

  Vehicle = CreateVehicle(vehicleid, X, Y, Z, A, 1, 169, -1); //Creates vehicle
  PutPlayerInVehicle(playerid, Vehicle, 0); //Puts you in the vehicle
  return 1;
}
second thing we need to do is to create an command:

Add this under OnPlayerCommandText:
pawn Код:
if(strcmp("/nrg", cmdtext, true, 10) == 0)
{
  SpawnVehicle(playerid, 522); //This creates an nrg and puts you in it.. ;D
  SendClientMessage(playerid, 0xF60000AA, "Your brand new nrg successfully spawned. :D");
  return 1;
}
you can create more cmds like this:

pawn Код:
if(strcmp("/infernus", cmdtext, true, 10) == 0)
{
  SpawnVehicle(playerid, 411); //You just need to change the 411 to vehicle you want to spawn. in this case you will spawn infernus.
  SendClientMessage(playerid, 0xF60000AA, "Your brand new infernus successfully spawned. :D");
  return 1;
}
Edited a bit

hope this helped.
-Augis, Tik LT server`is..


Re: Car spawner...[SOLVED!! XD THANX FOR ALL UR HELP! XD) - kaisersouse - 19.08.2009

Thanks for editing out the original problem. That sure will help people searching for solutions when they run into the same issue.