[GameMode] PPC_Trucking V1
#1

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.

https://sampforum.blast.hk/showthread.php?tid=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.


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: http://www.sa-mp.com/download.php 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: https://sampforum.blast.hk/showthread.php?tid=102865
- sscanf by Y-Less: https://sampforum.blast.hk/showthread.php?tid=120356
- zcmd by Zeex: https://sampforum.blast.hk/showthread.php?tid=91354
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: 127.0.0.1:7777
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 © 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 ****** 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):
https://github.com/PPC-Trucking/V1
Or all includes directly pasted into the main gamemode file:
http://users.telenet.be/vge/download...rucking_V1.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.
Reply
#2

Very nice ^^
Reply
#3

Nice i test it
Reply
#4

Really a terrorist class in a trucking server?
Reply
#5

Should be like a Cargo Stealer or something, where you're unloading, they can steal some of your cargo.
Reply
#6

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.
Reply
#7

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.

PPC_Questions
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 PPC_ServerSettings.inc 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 "PPC_DefLoads.inc", 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 PPC_DefLocations.inc 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.
Reply
#8

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.
Reply
#9

@Lookin,
Yeah, I've played on truckmania before and I'm still playing there, but not as much.
I played it for more than a week and suddenly I was banned by Dr. Hax for money-cheat.
I ddn't cheat, but because of lag I got banned.
I just finished my mission and the server thought I cheated the payout (or something like that).

Then I started my own trucking server, as I figured I could get banned again when finishing a mission.

Some things are based on TruckMania (but still my own code), but the military/terrorist class will be my own implementation.

I'm also looking for a camera that can act as a speedtrap, to place them on several places around the map.
When the player is driving too fast near such a camera, he should get one star.
Otherwise the police-class doesn't have much to do.
Does anybody know the object-model that could function as one (looks like one)?

I'll be using IsPlayerInRangeOfPoint to check if a player is near a speedtrap.

@Lynn,
Yeak I'm just a beginner.
You can see in my profile that I joined this forum on 16/11/2010.

But I've programmed before (I created my own Arkanoid3D game with Blitz3D once).
But discussing this, would be off-topic

I've even modified my load/save functions to NOT use dini anymore (too much read-write operations as I read somewhere else).

Also on my todo-list: housing system.
Reply
#10

woaaaaaw
very goood job
Reply
#11

Looking good, keep it going! XD
Reply
#12

Great for a beginner, keep up the good work.

-Conroy
Reply
#13

I just spent several hours to find every bus-stop in Las Venturas (in the main city, not in the desert) to mark them on a map.
Now I need to get the coordinates, create some bus-routes and then busdriver class will be implemented.
The class is there already, but you cannot start a job as a busdriver yet, as there is no code/busroute defined.

I'll keep ya posted on the progress.
Reply
#14

--- Truckmania design a lot Although I do really respect a ~from-the-zero~ GM

------Miralem
Reply
#15

I've taken alot of trucking-missions from TruckMania, that's true. As a newbie, you have to start somewhere with a few ideas from a good server.
But I'll have to re-create all trucking routes, as some are somewhat strange.

TruckMania is the only online server I play, so I take a few hints, ideas and design-elements from them to put in my own.

Bus-routes are working already (most of the code is finished and working, I have 39 busstops in Las Venturas), but I need some more work on it, as it's not finished yet.
The game doesn't respond on the racecheckpoint yet when you've finished your bus-route.
Bus-routes can have up to 20 busstops in them, but they can be small as well (like 5 busstops).
On each busstop, the player gets a small fee (now fixed at $500, but will be changed to a value based on the number of passengers).
When you've completed your route, you're given 2 checkpoints:
- one regular checkpoint that's the startlocation of the route, so you can keep doing the same route over and over again
- one race-checkpoint which points you to the busdepot (here you can end the route)

The busroutes are my own this time.
They are located in Las Venturas instead of Los Santos (TruckMania).
Reply
#16

I don't understand your Cmds systeme ? Can you explain to me please.


++Jones++
Reply
#17

very nice job
you make a new relase??
for the best GM:
mor missions
overload
more truck depots
speedcameras
House & Vehicle ownership
Convoy
speedo with fuel
Most Valued Worker Rank
and more...
Reply
#18

@Jones:

It's standard dcmd protocol.
I followed this tutorial:
https://sampwiki.blast.hk/wiki/Creating_...g_The_Commands
and some other dcmd tutorials, like: https://sampwiki.blast.hk/wiki/Dcmd

@[HUN]Poldzsiii:
Quote:

mor missions
overload
more truck depots
speedcameras
House & Vehicle ownership
Convoy
speedo with fuel
Most Valued Worker Rank
and more...

There will be new and much more missions, even more goods to transport.
I just took some goods from TruckMania to get an idea about some goods/routes and to check if I could code my own system to split everything up based on the vehiclemodel (which works perfectly btw).

Loads can be overloaded already. You'll get 2 more stars on your wanted level and the police players will see you in red on the radar.
Certain goods are also wanted by the mafia, they'll need to steal your truck/trailer, but mafia-class isn't implemented yet.
For being overloaded, you get 25% extra bonus when you deliver your load (doesn't matter if you got fined by the police or not, being fined doesn't reduce your load after all).
For a mafia-load, you get a 50% bonus when you deliver the load (when the mafia didn't get a chance to steal it, otherwise your mission fails).

There are already 8 truck depots, so that will do for now.
Maybe later on I could add some more.

I'm currently looking for a proper speedcamera, but cannot find a proper camera-model.
Has anybody an idea for those, which model-number could fit as a speedtrap camera?

Housing system will come too, you'll be able to buy a vehicle as soon as the housing system is complete (you'll buy the vehicle from within your house). Not sure about this though.

Convoys won't be implemented soon, but could some later on. I'll have to think about something like this about how it's gonna work.

The speedometer is already implemented, fuel-gauge yet to come, as well as refuelling system.

Most Valued Worker rank will also come if I can find some advantages for it when you get it.

I'll be releasing my gamemode often when time goes by.
Everytime a class is finished, I'll be releasing it.

More features will come too when everything else is complete.
Like fragile loads, this will come too.
You'll be transporting fragile loads from point A to B.
But your truck cannot take damage.
As soon as your truck takes damage, your mission will fail.
Reply
#19

Quote:
Originally Posted by Steven82
View Post
Really a terrorist class in a trucking server?
Ye Mafia IS there In Many Trucking Games.....
Reply
#20

Update:
- busdriver class working (only random routes, busdriver's license has no effect currently).

Only 3 testing busroutes for now (will be changed later, more routes to come), they have "SomeStart1" and "SomeStop1" as description.
Code is complete for now (maybe some changes later on), except for the busdrivers license.

When starting a busdriver job, you won't get any cash when you arrive on the first busstop.
Reason: you get $9 per passenger who LEAVES your bus (a random amount of passengers leave your bus when you stop on a busstop).
When you start the job, there aren't any passengers on your bus yet, so a passenger cannot leave and you get no payment.

Up to 30 passengers (minimum 10) can be waiting at a busstop.

The maximum amount of busstops per route has been changed to 30 (may change later in case some busroutes are longer).

When you have reached the last busstop on the route, you also get scorepoints (defined in the route).



Fixes:
- /work dialog was shown when you have a truckers license and you were not inside a trucking vehicle, you now get a message like always: "You must be driving a trucking vehicle to start a job"

New zip-file is uploaded, download it using the link in the first post.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)