Spawn Vehicles and save to File
#1

Im looking for a script that I can spawn a vehicle, and it saves it to a file, so that when the server starts, the file is loaded and the vehicle is spawned.

Like:

/createveh (modelID)

and possibly this, it doesnt matter if it doesnt:

/changevehcolor (color1) (color2)

So what /createveh would do is it would spawn that vehicle infront of you, and it saves it to a file, so that it spawns there again, even if the server restarts.

Anyone have a script that does that or similiar to that

Thanks =)
Reply
#2

If you're not able to find it in search than use this:
Script Request Thread

Seriously though, what you're describing is a simple script and definately a good thing to start on for a beginner. You should give it a whack atleast.
Reply
#3

Im not a coder, more of a server management typa preson. Thats why Im looking for this script =/
Reply
#4

I'll give you some tips, but no handouts

get dini.inc if you don't have it, get it here

to get it, click that link, click the "downloads" button in the upper right and find "dini v1.6" (use your browser's find function if you cant find it in the page)

then take this and paste it between the brackets in the "public OnVehicleSpawn" part in your file
Код:
  new file[256], Float:vehX, Float:vehY, Float:vehZ, Float:vehR, model;
  model = GetVehicleModel(vehicleid);
  format(file, sizeof(file), "Vehicles/%s.ini", vehicleid);
  if(dini_Exists(file)) return 1; // car exists in database
  GetVehiclePos(vehicleid, vehX, vehY, vehZ);
  GetVehicleZAngle(vehicleid, vehR);
  dini_IntSet(file, "model", model);
  dini_IntSet(file, "posX", vehX);
  dini_IntSet(file, "posY", vehY);
  dini_IntSet(file, "posZ", vehZ);
  dini_IntSet(file, "angle", vehR);
basically, what that does is save every vehicle in the game as a file, labeled the vehicle's ID. It's not very efficient, and doesn't save mods or colors (however, there is no GetVehicleColor, so that's not possible anyways :P)

you can make the "/createveh" command, that part is extremely easy, the first thing I learned about PAWN was to do "/" commands
Reply
#5

Quote:
Originally Posted by Annihalation
I'll give you some tips, but no handouts

get dini.inc if you don't have it, get it here

to get it, click that link, click the "downloads" button in the upper right and find "dini v1.6" (use your browser's find function if you cant find it in the page)

then take this and paste it between the brackets in the "public OnVehicleSpawn" part in your file
Код:
  new file[256], Float:vehX, Float:vehY, Float:vehZ, Float:vehR, model;
  model = GetVehicleModel(vehicleid);
  format(file, sizeof(file), "Vehicles/%s.ini", vehicleid);
  if(dini_Exists(file)) return 1; // car exists in database
  GetVehiclePos(vehicleid, vehX, vehY, vehZ);
  GetVehicleZAngle(vehicleid, vehR);
  dini_IntSet(file, "model", model);
  dini_IntSet(file, "posX", vehX);
  dini_IntSet(file, "posY", vehY);
  dini_IntSet(file, "posZ", vehZ);
  dini_IntSet(file, "angle", vehR);
basically, what that does is save every vehicle in the game as a file, labeled the vehicle's ID. It's not very efficient, and doesn't save mods or colors (however, there is no GetVehicleColor, so that's not possible anyways :P)

you can make the "/createveh" command, that part is extremely easy, the first thing I learned about PAWN was to do "/" commands
Okay, so it will save any vehicle spawned to Vehicles.ini ?
Reply
#6

Im getting
Quote:

C:\samp02Xserver.win32\gamemodes\DoW.pwn(67) : warning 213: tag mismatch
C:\samp02Xserver.win32\gamemodes\DoW.pwn(6 : warning 213: tag mismatch
C:\samp02Xserver.win32\gamemodes\DoW.pwn(69) : warning 213: tag mismatch
C:\samp02Xserver.win32\gamemodes\DoW.pwn(70) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Warnings.

Reply
#7

*bump*
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)