SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Gamemode Scripts

Reply
 
Thread Tools Display Modes
Old 05/12/2010, 06:17 PM   #1
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,752
Reputation: 238
Default 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.

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.


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: http://forum.sa-mp.com/showthread.php?t=102865
- sscanf by Y-Less: http://forum.sa-mp.com/showthread.php?t=120356
- zcmd by Zeex: http://forum.sa-mp.com/showthread.php?t=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 (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 (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.

Last edited by PowerPC603; 07/02/2017 at 10:51 PM.
PowerPC603 is offline   Reply With Quote
Old 05/12/2010, 06:27 PM   #2
universe
Huge Clucker
 
Join Date: Nov 2009
Location: Spain - Cataluñia
Posts: 270
Reputation: 2
Default Re: My own trucking server (still in development)

Very nice ^^
__________________
universe is offline   Reply With Quote
Old 05/12/2010, 07:02 PM   #3
SamyRomafia
Huge Clucker
 
SamyRomafia's Avatar
 
Join Date: Oct 2010
Location: Italia
Posts: 296
Reputation: 3
Default Re: My own trucking server (still in development)

Nice i test it
__________________
Hey guys.

I need a good scripter who can help me. I can pay for this work but im not a rich mean, i can pay as much as possible.
I need to configure a server whit a website, and other works, i tried to do this but my attempts have failed.
If you can help me send me a private message and i give you more info.

Thanks for your attention.
SamyRomafia is offline   Reply With Quote
Old 05/12/2010, 07:08 PM   #4
Steven82
High-roller
 
Join Date: Nov 2009
Posts: 2,613
Reputation: 170
Default Re: My own trucking server (still in development)

Really a terrorist class in a trucking server?
__________________
I do not play anymore. If you see my name on a server, it is not me. What a ride SA-MP has been, thankful for the people I met and the memories I have made while playing. God speed.
Steven82 is offline   Reply With Quote
Old 05/12/2010, 07:16 PM   #5
Ruffles.
Gangsta
 
Ruffles.'s Avatar
 
Join Date: Apr 2010
Location: Canada
Posts: 548
Reputation: 29
Default 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.
__________________

Unlike a lot of people, I don't ask for rep.

Lawedan Computers, Inc Links
Webpage | Lawedan Armoured Company Clan Page | World of Tanks | World of Warplanes



Ruffles. is offline   Reply With Quote
Old 05/12/2010, 09:23 PM   #6
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,752
Reputation: 238
Default 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.
PowerPC603 is offline   Reply With Quote
Old 05/12/2010, 09:26 PM   #7
Ash.
High-roller
 
Ash.'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 2,119
Reputation: 163
Default 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.

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:
Code:
#define GameModeName				"PowerPC603's Trucking Server"
Change that into:
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:
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:
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:
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:
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.
__________________
TruckingWorld
Work, Play, Make Friends
Written from scratch, and originally released in 2011, play today!
Visit the forum | Play the game

Last edited by Ash.; 31/12/2011 at 12:05 PM.
Ash. is offline   Reply With Quote
Old 05/12/2010, 09:29 PM   #8
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,752
Reputation: 238
Default 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.
PowerPC603 is offline   Reply With Quote
Old 06/12/2010, 12:24 AM   #9
Lookin
Gangsta
 
Lookin's Avatar
 
Join Date: May 2010
Location: Wai O Taiki Bay, Aotearoa
Posts: 639
Reputation: 14
Default Re: My own trucking server (still in development)

it sounds a bit like truck mania
__________________

Now Recruiting! Go to http://www.pgclan.org/





Lookin is offline   Reply With Quote
Old 06/12/2010, 12:27 AM   #10
Lynn
High-roller
 
Lynn's Avatar
 
Join Date: Jan 2010
Location: Detroit, Michigan USA
Posts: 1,123
Reputation: 108
Default Re: My own trucking server (still in development)

Looks good.
Good job, for being a beginner :P.
Lynn is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] PPC_TRUCKING ThiagoMK Português/Portuguese 4 30/07/2013 05:44 PM
Fix id Bug in PPC_Trucking Geeboi_Mehdi Client Support 11 18/05/2013 08:02 PM
PPC_Trucking Baumann Scripting Help 1 07/12/2012 03:28 PM
PPC_Trucking Baumann Scripting Help 1 02/12/2012 02:43 PM
PPC_Trucking help Private200 Scripting Help 1 16/11/2012 08:23 AM


All times are GMT. The time now is 10:59 PM.


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