SA-MP Forums

SA-MP Forums (
-   Gamemode Scripts (
-   -   [GameMode] PPC_Trucking V1 (

PowerPC603 05/12/2010 06:17 PM

PPC_Trucking V1
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.
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.

You are allowed to use this gamemode to run your own server and you are also allowed to modify it.
Don't claim this code to be your own.
Also, if you want to re-release a modified version of this script, don't forget me in the credits.
Last but not least: don't re-release it under the name "PPC Trucking V2" or anything similar.

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 the server package here: and unzip it in D:\Server
2. Download this script and unzip is as well, and put everything in the correct folders
3. You need several plugins/includes as well:
- streamer by Incognito:
- sscanf by Y-Less:
- zcmd by Zeex:
4. Double click the file "D:\Server\Samp server.exe" to start the server
5. If the server is running, you'll see that the last line will say: "Number of vehicle models: 25"
6. Open the samp client and add a new server to your favorites by clicking the orange button with a check (Add server) and input:
7. Now you can play locally by choosing the new server you added and start the game.

You must also create a few folders in your scriptfiles folder:
- scriptfiles/ServerData/Players
- scriptfiles/ServerData/Houses
- scriptfiles/ServerData/Cameras
- scriptfiles/ServerData/Business
- scriptfiles/ServerData/Bank

If those folders do not exist, your server will crash.

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 "".
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 ****** 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 (adapted to work on samp 0.3x by malaka):
Or all includes directly pasted into the main gamemode file:


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.

universe 05/12/2010 06:27 PM

Re: My own trucking server (still in development)
Very nice ^^

SamyRomafia 05/12/2010 07:02 PM

Re: My own trucking server (still in development)
Nice i test it

Steven82 05/12/2010 07:08 PM

Re: My own trucking server (still in development)
Really a terrorist class in a trucking server?

Ruffles. 05/12/2010 07:16 PM

Re: My own trucking server (still in development)
Should be like a Cargo Stealer or something, where you're unloading, they can steal some of your cargo.

PowerPC603 05/12/2010 09:23 PM

Re: My own trucking server (still in development)
The terrorist class will need to stop military transports only.
They are not meant to just shoot everything and everybody.

The Military class wil be some sort of trucker class, they need to transport weapons to various locations.
Some cargo will be wanted by the terrorists, same as mafia-wanted loads in trucking servers.

The terrorists can either steal the cargo or they can stop the military, preventing from reaching the destination.
There will be several rewards (small reward for destroying the military transport, big reward for stealing it).

If they shoot anybody else (a non-military class or a military class without terrorist-wanted load), they will lose 5 points on their score as punishment.

The military can use helicopters and planes to aid their transports.
The terrorists will have those too.

The mafia will be cargo-stealers as well.
While a trucker is transporting a mafia-wanted load, the mafia will be informed about it and they need to try to steal the trucker's trailer (or the truck itself, together with the trailer).
Do they succeed and bring the trailer to the mafia-hideout, they will be rewarded.

But they will have to steal the trailer before the mission of the trucker fails.
As soon as the trucker loses his trailer, there is a 60 second countdown for the trucker.
He'll fail the mission when the countdown reached 0.
So as soon as the mafia succeed in detaching the trucker's trailer, they have 60 seconds to attach the trailer to their own truck.

I'm just trying to add several different things to my own gamemode.

Ash. 05/12/2010 09:26 PM

Re: My own trucking server (still in development)
This was my first post on this thread (05/12/2010!). I am using this post for this so it is on the first page.


Here are some very frequently asked questions with their answers. Some of you may first be asking why I'm posting this rather than PowerPC603 himself. I'm doing this because if I were in his position, I'd be getting very annoyed at many of you right now. He clearly stated that this gamemode was not for new/less experienced scripters, and he has also made editing things very simple, and yet some of you just fail to use your eyes.

Disclaimer: I do not use this gamemode, nor have I been following this thread since page one - however I have skimmed through the script while writing this post, so you will have to excuse me if I make some minor errors.

I will begin.
How do I change the server's name?
PowerPC603 has answered this many times.
Open pawno.exe with administrator privileges (right click "pawno.exe", choose "properties", choose "Compatibility", then check the "run this as administrator").
Then open "gamemodes\PPC_Trucking.pwn".

This is the main gamemode-file.

On line 10, you'll find this:
pawn Code:
#define GameModeName                "PowerPC603's Trucking Server"
Change that into:
pawn Code:
#define GameModeName                "YOUR_NEW_SERVER_NAME"

Then press F5 to compile the gamemode again.
Now you've changed the name of your server.

Upload the new PPC_Trucking.amx file to your host and restart the server for changes to take effect.

How do I change *this* in my gamemode?
Edit the include called in pawno/includes/*.inc.
Don't rename any variables though, doing so will result in (probably multiple) errors.

How can I disable a certain class?
In the main gamemode file (PPC_Trucking.pwn) you'll find the function
public OnPlayerRequestSpawn(playerid)

This function executes code when you choose to spawn as a member of a specific class.
You'll find this code in there:
pawn Code:
case ClassCourier:
            Index = random(sizeof(ASpawnLocationsCourier));
            x = ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation
            y = ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation
            z = ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            Angle = ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
            format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Courier class", Name);

You can change it to this:
pawn Code:
case ClassCourier:
            Index = random(sizeof(ASpawnLocationsCourier));
            x = ASpawnLocationsCourier[Index][SpawnX]; // Get the X-position for the spawnlocation
            y = ASpawnLocationsCourier[Index][SpawnY]; // Get the Y-position for the spawnlocation
            z = ASpawnLocationsCourier[Index][SpawnZ]; // Get the Z-position for the spawnlocation
            Angle = ASpawnLocationsCourier[Index][SpawnAngle]; // Get the rotation-angle for the spawnlocation
//          format(Msg, 128, "{00FF00}Player {FFFF00}%s{00FF00} joined {FFFF00}Courier class", Name);

            // Let the player know he cannot choose courier class as the admin disabled this class
            GameTextForPlayer(playerid, "Courier-class has been disabled by the server-admin", 5000, 4);
            SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Courier-class has been disabled by the server-admin");
            return 0; // Don't allow the player to spawn as courier player
This will prevent anyone to choose the courier-class as it has been disabled by the "return 0;".
This blocks the function to spawn the player as the chosen class.
Also the player will be informed that this class has been disabled.

You can use the same setup to disable any other class.

How can I add more missions to the trucking class?
Lets say you want to add a new destination for the product "Wheat" when using an ore-trailer.
In the file "", you'll see this line:
pawn Code:
{"Wheat", false, 1.00, PCV_TruckerOreTrailer, {21, 22}, {18, 23, 24}}, // LoadID 10

This means:
- productname = Wheat
- this is a load that's not wanted by the mafia, as it says "false"
- productprice per meter: $1.00 (used to calculate your payment by calculating the distance between loading and unloading point, multiplied by this value)
- type of class and vehicle: Trucker class with ore trailer
- pickup-locations: 21 and 22 (resp: "EasterBoard Farm" and "SF Hill Farm"), these are the location-id's where you load the product
- destination locations: 18, 23, 24 (resp: "LV Freight Depot", "Pecker's Feed & Seed", "San Fierro Port"), these are the location-id's where you must unload the product

To add a new destination, we check which location where we wanna bring the wheat.
Let's say you want to deliver it to "LS Ocean Docks" too (we check the file and we find location-ID 38 for "LS Ocean Docks").

So you add it like this:
pawn Code:
{"Wheat", false, 1.00, PCV_TruckerOreTrailer, {21, 22}, {18, 23, 24, 38}}, // LoadID 10

That's it. After saving the file, you only need to recompile and restart the server.

You can add up to 30 pickup-locations and 30 delivery locations per product, that's 900 routes for each product, because you can pickup the load at any defined pickup-location and deliver it to any of the delivery-locations.

I will be adding more to this post as I see them.

PowerPC603 05/12/2010 09:29 PM

Re: My own trucking server (still in development)
Convoy Trucking? Never heard of it.

I'm looking at some features here and there, but I'm creating my own code to do it all.
I'm not copy-pasting bits from other gamemodes into my own.

Lookin 06/12/2010 12:24 AM

Re: My own trucking server (still in development)
it sounds a bit like truck mania

Lynn 06/12/2010 12:27 AM

Re: My own trucking server (still in development)
Looks good.
Good job, for being a beginner :P.

All times are GMT. The time now is 03:34 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.