SA-MP Forums Archive
Vehicle Spawn - 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)
+--- Thread: Vehicle Spawn (/showthread.php?tid=492863)



Vehicle Spawn - CallumDaBest - 05.02.2014

I was wondering if anyone knew the /veh command is? - This is for my new big project called Millenium Roleplay!!!



If you wish to help on Millenium Roleplay contact me on skype - e.r.r.y!!


Re: Vehicle Spawn - BullseyeHawk - 05.02.2014

Here is the "skeleton" or layout of the command:

pawn Код:
// Somewhere in the millenium code
new gVehStoreVal[MAX_PLAYERS];

// OnPlayerConnect
gVehStoreVal[playerid] = INVALID_VEHICLE_ID;

OnPlayerCommandText(...)
{
   if(strcmp(cmdtext, "/veh") == 0)
   {
      if(gVehStoreVal[playerid] == INVALID_VEHICLE_ID)
      {
          // Grab params here.
          // https://sampwiki.blast.hk/wiki/Creating_Commands

          // Create a vehicle after all params are okay
          // https://sampwiki.blast.hk/wiki/AddStaticVehicleEx
      }
      else
      {
          // Vehicle already created, notify player!
      }
   }
}
And you can use gVehStoreVal[<integer>]; on /destroyveh.
Or you can even create it without them.

https://sampwiki.blast.hk/wiki/Creating_Commands
https://sampwiki.blast.hk/wiki/AddStaticVehicleEx

If you're going to build a full gamemode, I suggest you firstly learn the basics.