Tuesday, March 26, 2013

PPC Trucking gamemode

When I joined the SAMP forum on 16/11/2010, I was a complete newbie when it comes to Pawn scripting.
I had some experience writing programs, even small databases, in Visual Basic 6.0 and BlitzBasic3D though, so I'm not new to programming in general.

http://forum.sa-mp.com/showthread.php?t=184109
This is the gamemode (made by Rokzlive) which I used to get started, but I soon realised that everything needed to be rewritten to allow more flexibility, so I started from scratch again.
Thanks to Rokzlive for this, as still a few commands are still being used inside this gamemode (like /flip and /detach).

I've been writing this gamemode for the past 4 months and I think I can be proud to say that the script has success.
This is the last version for now, as I have other things to do right now (careing for my baby).

UPDATE: the baby is born today, so the gamemode isn't in development anymore.
This project has been discontinued.


PPC Trucking V2 is in full development however, but when released, it will be in a separate thread.


NOTE: this script is quite complex.
If you don't know anything about:
- unzipping a file
- scripting or programming in general
- editing account-files (plain text-files)
- running a server

Don't use it if you lack any knowledge about one of these things.

Current features:
- trucking missions (231 routes)
- busdriver missions (7 routes for now)
- trucker's license and busdriver's license can be bought at driving school in Doherty (allows you to choose your own routes)
- speedometer with fuel-gauge (you can refuel at a gas station, just park your car over a refuel pickup and honk the horn)
- pilot missions (you need to transport passengers and cargo between the major airports with a shamal airplane), this class has 82 routes (also includes helicopter routes, these only transport passengers)
- alot of commands (use the /cmds command to list them all)
- police class
- mafia class (you can steal a trucker's trailer or truck when they have a load that's wanted by the mafia)
- housing system (2 houses per player by default, editable)
- car-ownership (maximum 5 vehicles per house, not editable)
* - house-level 1 or 2 supports 1 carslot
* - house-level 3 or 4 supports 2 carslots
* - house-level 5 or 6 supports 3 carslots
* - house-level 7 or 8 supports 4 carslots
* - house-level 9 or 10 supports 5 carslots
- rentable cars (Wang Cars), these disappear when you logout, you won't get it back when you login
- speedcamera's to catch speeders (the police will see speeders in red on the radar and need to fine them)
- business system (you can buy up to 2 businesses, these generate money every hour even when you're offline)
- roadworker class with 2 job-types: you can use a utility van with utility trailer to fix speedcamera's and you can use a towtruck to tow broken vehicles to the shredder
- several anti-hacking systems, such as anti-jetpack hack, anti-money hack, anti-score hack, speed hack (anyone driving a vehicle over 300kph is kicked), anti-weapons hack
- built-in bank system (deposit and withdraw money, transfer money to online or offline players and hourly intrest of 0.1% per hour, even when offline)

To install properly: (I'm using a example directory "D:\Server" here, change this to wherever you want to install the server)
1. Download this script (it now comes with everything you need: default samp includes, pawno.exe and samp-server.exe)
2. Unzip it somewhere (example: D:\Server)
3. Double click the file "D:\Server\Samp server.exe" to start the server
4. If the server is running, you'll see that the last line will say: "Number of vehicle models: 25"
5. Open the samp client and add a new server to your favorites by clicking the orange button with a check (Add server) and input: 127.0.0.1:7777
6. Now you can play locally by choosing the new server you added and start the game.

To edit something (or do a re-compile):
1. Right-click "D:\Server\Pawno\Pawno.exe", select "Properties", then "Compatibility" and set it to execute as administrator
2. Open the pawno.exe in the same directory (D:\Server\Pawno\Pawno.exe)
3. From within pawno, select "File -> Open" and load the main script (D:\Server\gamemodes\PPC_Trucking.pwn)
4. Press F5 to compile the script
5. If everything went ok, you'll see a new window without errors and the first line should say:
"Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase"
6. Close pawno

NOTE: Do NOT open the file PPC_Trucking.pwn by double clicking it and launching pawno that way.
Always open pawno first, then open the file using pawno's menu: File -> Open.


To set yourself as admin:
1. Start your game and register (input your password)
2. Exit the game, your account will be saved
3. Go to the folder "D:\Server\scriptfiles\ServerData\Players"
4. You'll see an ini-file with your name, open it with Notepad
5. You'll see a line that says: "Level 0", change that to "Level 5" and save the file again (leave the rest as it is)
6. Start your game again and login, you're now admin lvl 5

You only need to do this once.
After you've set yourself as lvl 5 admin, you can set admin-levels to other players with the /setlevel command.


To make the roadworker and courier classes working properly, you'll need to create speedcamera's and houses.
To create those, you need to be admin lvl 5.
Just go to a spot where you want to create a house and enter the command: /createhouse <price> <maxlevel (1-10)>
"/createhouse 158000 8" would create a house which costs $158000 to buy, with a maximum upgrade-level of 8.
To delete a house, stand near the pickup and use /delhouse.

To create speedcamera's, go to a spot where you want it and use the command /createcamera <maxspeed>
"/createcamera 120" would create a speedcamera which gives one star when you drive past it at a speed higher than 120.
To delete a speedcamera, stand near the camera and use /delcamera.



To edit the servername, change the variable (GameModeName) on top of the main script.
This has been moved their because lots of users don't find out how to change the name of the server.

To edit other things, checkout the file "PPC_ServerSettings.inc".
You can also set the amount of houses/businesses per player to another value, but I don't recommend going over 20, as the dialogs use variables to display the contents and the variables are limited in size.
Setting it higher than 20 could result in not seeing all your houses/businesses in the dialog.

For letting others join your server, you'll need to port-forward your server's port (mostly 7777) on your router to your pc.
As every router works differently, I can't give exact details here, but you can google for an explanation how to open a port on your router by searching for "port forward router xxx", where xxx is your router brand and model.

Download it here:
http://users.telenet.be/vge/downloads/PPC_Trucking6.zip

PS:

May I please ask that you don't ask me to help run your own server-scripts, host a server, play admin or anything else.
This project is only to have fun, learn something about scripting and to pass some free time.
You can do whatever you want with it, but I won't have any spare time to work on something else.
I'll help if there are problems with my own script and fix bugs if you find some or to explain something if you don't understand it.
Also, please don't ask me to help you write your own scripts when you don't know anything about scripting.

Warnings or errors shouldn't be present when you run this script, as everything is checked before I upload a new version.
If you get errors or warnings, chances are that you didn't extract ALL the files.
When you have an older version of this script and you want to use the latest version, be sure to extract ALL the files, overwriting the old ones.
If you don't, errors/warnings WILL occur, as everything is connected to eachother.
Functions are all over the include-files and most of them need functions or defines from other include-files.
So, update ALL files always.

No comments:

Post a Comment