SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 09/09/2011, 09:11 PM   #1
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,251
Reputation: 152
Default PPC Speedometer

I've just completed my speedometer filterscript and has some nice features.
It was part of my gamemode (PPC_Trucking), but has been adapted to work standalone.

It has:
- speedometer
- fuel gauge
- refuel-stations (gas-stations): to refuel your vehicle, stand near a gas-station pickup and honk the horn
- speedcamera's

Also, 2 bugs have been fixed in this script (but not yet in the gamemode):
- the first created refuel-station didn't work (you couldn't refuel your vehicle at this gas-station)
- every player inside a car consumed 1 fuel every half a second (so with 4 players inside the same car, the vehicle would consume fuel 4 times faster), now it only consumes fuel for the driver

The filterscript uses Incognito's streamer for the pickups and 3DText labels, so you need it for this script to work.
http://forum.sa-mp.com/showthread.php?t=102865
It also uses sscanf (I'm still using an older version, as I still use Samp 0.3c):
http://forum.sa-mp.com/showthread.php?t=120356
And zcmd is also required:
http://forum.sa-mp.com/showthread.php?t=91354



To install this filterscript:
- just copy the file to your filterscript's folder and add "PPC_Speedo" it to your server.cfg file on the "filterscripts" line:
Code:
filterscripts gl_realtime gl_actions PPC_Speedo
To create speedcamera's, login to RCON and use this command to create a new speedcamera:
/createcamera <max_speed>

Replace <max_speed> by the required speed for this camera.
Example:
/createcamera 90
This creates a speedcamera which gives you one star on your wanted level if you drive past it faster than 90kph.

/delcamera can be used to delete the camera near your location.

All camera-data is saved in the file "scriptfiles\Cameras.ini". The location of the file and filename can be adjusted if required at the top of the script.

Also added is an admin-command: /fuel.
This will allow RCON admins to refuel their vehicle free of charge.



There are also a few functions that are something special, which allow cross-script communication:
- Speedo_GetVehicleFuel(vehicleid)
- Speedo_SetVehicleFuel(vehicleid, fuel)
- Speedo_GetPlayerSpeed(playerid)

These functions can be called from other scripts using "CallRemoteFunction".
They allow you to:
- get the fuel of the given vehicle
- set the fuel of the given vehicle
- get the player's speed



Also, there are a few functions that you need to copy and modify to your gamemode or other filterscripts if you use server-sided money.
The filterscript normally has no access to your account-data that your gamemode might hold, but these functions allow the speedometer script to get data from your gamemode if you copy them to your gamemode.
They are near the bottom of the filterscript.

If you don't copy and edit them, the script will automatically use client-sided money.
pawn Code:
// This function is used to get the player's money
forward EXT_GetPlayerMoney(playerid);
public EXT_GetPlayerMoney(playerid)
{
    return APlayerData[playerid][PlayerMoney];
}

// This function is used to get the player's money
forward EXT_GivePlayerMoney(playerid, Money);
public EXT_GivePlayerMoney(playerid, Money)
{
    // Add the given money to the player's account
    APlayerData[playerid][PlayerMoney] = APlayerData[playerid][PlayerMoney] + Money;

    // Return that the function had success (another script holds the player's money on the server-side)
    return 1;
}

// This function is used to get the player's admin-level
forward EXT_GetPlayerAdminLevel(playerid);
public EXT_GetPlayerAdminLevel(playerid)
{
    return APlayerData[playerid][AdminLevel];
}

// This function is used to determine if the player has logged in (he succesfully entered his password)
forward EXT_IsPlayerLoggedIn(playerid);
public EXT_IsPlayerLoggedIn(playerid)
{
    if (APlayerData[playerid][LoggedIn] == true)
        return 1; // The player has logged in succesfully
    else
        return -1; // The player hasn't logged in (yet)
}
The inner workings of these functions are pretty much self-explanatory.
You might need to edit the location of your data (pData[playerid][Money] for example, instead of APlayerData[playerid][PlayerMoney]).

All commands are also edited to include remote checks to see if a player has logged in properly and if he has admin-status.
Logging in properly: a player must enter his password before he's allowed to use any command.
Of course, your gamemode or admin-script needs to set a variable for this.
See my gamemode (PPC_Trucking) to see how it works.

If the admin-status isn't remotely checked (you didn't copy/adapt the remote functions), RCON admin status is checked automatically.
Also, the logged-in status is skipped if the remote functions aren't used and the player can use the commands freely (if they're logged in as RCON admin).


The script also has support for my housing script, which will be released soon (still adding new stuff and testing the whole script).
House-owned vehicles won't get refuelled automatically when they respawn, as the housing script will manage the fuel remotely.
If you don't use the housing script, nothing will be bugged, as it's designed to work properly when used standalone.

The housing system will also work standalone and doesn't depend on this speedometer script.
It will only call some remote functions in this script to manage a vehicle's fuel (getting the fuel for saving the vehicle's fuel and setting the fuel when the vehicle is loaded).
Only the fuel will be saved as 0 when this script isn't used.



Screenshot (at a gas-station):


Screenshot (speeding near a speedcamera which is set to catch you above 120kph):


Download it here:
http://users.telenet.be/vge/download...PPC_Speedo.pwn
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
--------------------------------------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
No release-date yet for PPC Trucking V2, so don't ask
--------------------------------------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business

Last edited by PowerPC603; 15/09/2011 at 08:35 AM.
PowerPC603 is offline   Reply With Quote
Old 09/09/2011, 09:26 PM   #2
FireCat
Banned
 
Join Date: Jul 2010
Posts: 2,472
Reputation: 596
Default Re: PPC Speedometer

Nice, I guess?
FireCat is offline   Reply With Quote
Old 09/09/2011, 09:30 PM   #3
Gforcez1337
Gangsta
 
Join Date: Jul 2010
Location: The Netherlands.
Posts: 696
Reputation: 191
Default Re: PPC Speedometer

screenshots?
__________________

Gforcez1337 is offline   Reply With Quote
Old 09/09/2011, 09:39 PM   #4
X3nZ
Gangsta
 
X3nZ's Avatar
 
Join Date: Mar 2011
Location: United States of 'murica
Posts: 601
Reputation: 30
Default Re: PPC Speedometer

Yo, sounds nice, but can we get some screenies?
__________________
Credit to Zh3R0 for the signature.
X3nZ is offline   Reply With Quote
Old 09/09/2011, 09:57 PM   #5
Rock_Ro
Huge Clucker
 
Join Date: Mar 2011
Location: Los Santos
Posts: 281
Reputation: 2
Default Re: PPC Speedometer

People ask for screenshot man!

Do it for us! Make a screenshot!
Rock_Ro is offline   Reply With Quote
Old 09/09/2011, 10:00 PM   #6
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,251
Reputation: 152
Default Re: PPC Speedometer

Just uploaded a screenshot.
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
--------------------------------------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
No release-date yet for PPC Trucking V2, so don't ask
--------------------------------------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business
PowerPC603 is offline   Reply With Quote
Old 09/09/2011, 10:10 PM   #7
Rock_Ro
Huge Clucker
 
Join Date: Mar 2011
Location: Los Santos
Posts: 281
Reputation: 2
Default Re: PPC Speedometer

Quote:
Originally Posted by PowerPC603 View Post
Just uploaded a screenshot.
Ohh..thanks!

So..i see this kind of speedometer somewhere..i think it's just desing..
Rock_Ro is offline   Reply With Quote
Old 09/09/2011, 10:48 PM   #8
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,251
Reputation: 152
Default Re: PPC Speedometer

You might have seen this speedometer on some trucking server, which used my gamemode.

I'm splitting up my gamemode in several different filterscripts, as I need some of them for my next gamemode(s).
I don't want to re-create all the code everytime when I launch another gamemode.
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
--------------------------------------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
No release-date yet for PPC Trucking V2, so don't ask
--------------------------------------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business
PowerPC603 is offline   Reply With Quote
Old 10/09/2011, 02:00 AM   #9
Haydn
High-roller
 
Haydn's Avatar
 
Join Date: Mar 2011
Location: Dorset,England
Posts: 1,647
Reputation: 333
Default Re: PPC Speedometer

COOL!
__________________
i dont really use the forum anymore i check it everyday though so message me if you want to talk to my fabulous soul
Haydn is offline   Reply With Quote
Old 10/09/2011, 04:27 PM   #10
Skyny10
Little Clucker
 
Join Date: Jan 2011
Posts: 9
Reputation: 2
Default Re: PPC Speedometer

Good Job! Thank you.
Skyny10 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
[HELP] My speedometer Yuval_Baruch Scripting Help 2 15/12/2011 11:51 AM
Please help with a speedometer tyomis Scripting Help 2 31/08/2011 05:39 PM
Speedometer..... Gh0sT_ Help Archive 8 14/11/2010 10:32 PM
SpeedoMeter Help Proteine Help Archive 7 15/10/2010 03:38 PM
Speedometer and Name car icebox10 Help Archive 0 30/07/2009 02:05 PM


All times are GMT. The time now is 11:45 AM.


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