SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 16/07/2018, 10:17 AM   #1
PgMNA
Little Clucker
 
Join Date: Nov 2017
Location: Pakistan,Karachi
Posts: 25
Reputation: 1
Post Advance Double Speed-O-Meter [Version 2]

Hello,
This is Second version of my old speedometer, can simply change meter by /meterchange but you will need to rcon login first.

Version 1:
http://forum.sa-mp.com/showthread.php?t=656235

Whats New?
- New 3rd Speed-O-Meter Added.
- Fixed Speed Calculations.
- Changed some Global Textdraws to PlayerTextdraws to avoid bug.


ScreenShots:
Speed-O-Meter[1]:










Speed-O-Meter[2]:







Speed-O-Meter[3]:







Downloads:
PasteBin
Mediafire

Credits:
MNA
__________________
My Works:
Advance Double Speed-O-Meter
Discord: MNA#8254
PgMNA is offline   Reply With Quote
Old 16/07/2018, 05:32 PM   #2
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 92
Default Re: Advance Double Speed-O-Meter [Version 2]

PHP Code:
forward CarSpawner(playerid,model);
public 
CarSpawner(playerid,model)
{
    if(
IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid0x33AA33AA"You already have a car!");
    else
    {
        new 
Float:xFloat:yFloat:zFloat:angle;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playeridangle);
        
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
        
new vehicleid=CreateVehicle(modelxyzangle, -1, -1, -1);
        
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
        
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
        
PutPlayerInVehicle(playeridvehicleid0);
        
ChangeVehicleColor(vehicleid,0,7);
        
//PlayerInfo[playerid][pCar] = vehicleid;
    
}
    return 
1;

why not

PHP Code:
CarSpawner(playerid,model)
{
    if(
IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid0x33AA33AA"You already have a car!");
    else
    {
        new 
Float:xFloat:yFloat:zFloat:angle;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playeridangle);
        
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
        
new vehicleid=CreateVehicle(modelxyzangle, -1, -1, -1);
        
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
        
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
        
PutPlayerInVehicle(playeridvehicleid0);
        
ChangeVehicleColor(vehicleid,0,7);
        
//PlayerInfo[playerid][pCar] = vehicleid;
    
}
    return 
1;

AND

why use 3 callbacks 1 to get health 2 to set speedtextdraw and 3 get speed while this could be done in 1 callback

You could use 1 timer

Why include foreach and not use it?

Why dont you destroy player text draw when player leaves
__________________
Lokii is offline   Reply With Quote
Old 16/07/2018, 05:41 PM   #3
Freaksken
Gangsta
 
Freaksken's Avatar
 
Join Date: Mar 2009
Location: Belgium
Posts: 506
Reputation: 368
Default Re: Advance Double Speed-O-Meter [Version 2]

Quote:
Originally Posted by Lokii View Post
Why dont you destroy player text draw when player leaves
SA-MP does that automatically.
__________________
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.


[Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like co-op mission - [Other] List of all my work
Freaksken is offline   Reply With Quote
Old 16/07/2018, 10:00 PM   #4
Usmanmemon
Big Clucker
 
Usmanmemon's Avatar
 
Join Date: May 2017
Posts: 55
Reputation: 13
Default Re: Advance Double Speed-O-Meter [Version 2]

Nice Work Bro, i Know you.
Usmanmemon is offline   Reply With Quote
Old 16/07/2018, 10:45 PM   #5
PgMNA
Little Clucker
 
Join Date: Nov 2017
Location: Pakistan,Karachi
Posts: 25
Reputation: 1
Default Re: Advance Double Speed-O-Meter [Version 2]

Quote:
Originally Posted by Lokii View Post
PHP Code:
forward CarSpawner(playerid,model);
public 
CarSpawner(playerid,model)
{
    if(
IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid0x33AA33AA"You already have a car!");
    else
    {
        new 
Float:xFloat:yFloat:zFloat:angle;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playeridangle);
        
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
        
new vehicleid=CreateVehicle(modelxyzangle, -1, -1, -1);
        
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
        
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
        
PutPlayerInVehicle(playeridvehicleid0);
        
ChangeVehicleColor(vehicleid,0,7);
        
//PlayerInfo[playerid][pCar] = vehicleid;
    
}
    return 
1;

why not

PHP Code:
CarSpawner(playerid,model)
{
    if(
IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid0x33AA33AA"You already have a car!");
    else
    {
        new 
Float:xFloat:yFloat:zFloat:angle;
        
GetPlayerPos(playeridxyz);
        
GetPlayerFacingAngle(playeridangle);
        
//if(PlayerInfo[playerid][pCar] != -1) CarDeleter(PlayerInfo[playerid][pCar]);
        
new vehicleid=CreateVehicle(modelxyzangle, -1, -1, -1);
        
SetVehicleVirtualWorld(vehicleidGetPlayerVirtualWorld(playerid));
        
LinkVehicleToInterior(vehicleidGetPlayerInterior(playerid));
        
PutPlayerInVehicle(playeridvehicleid0);
        
ChangeVehicleColor(vehicleid,0,7);
        
//PlayerInfo[playerid][pCar] = vehicleid;
    
}
    return 
1;

AND

why use 3 callbacks 1 to get health 2 to set speedtextdraw and 3 get speed while this could be done in 1 callback

You could use 1 timer

Why include foreach and not use it?

Why dont you destroy player text draw when player leaves
that code i used to spawn car in server forgot to remove and all other things are perfectly fine!
__________________
My Works:
Advance Double Speed-O-Meter
Discord: MNA#8254
PgMNA is offline   Reply With Quote
Old 17/07/2018, 08:55 AM   #6
xMoBi
Banned
 
Join Date: Jul 2017
Location: Islamic Republic of Pakistan
Posts: 98
Reputation: 26
Default Re: Advance Double Speed-O-Meter [Version 2]

Code:
//speedo1
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new PlayerText:Textdraw3[MAX_PLAYERS];
new Text:Textdraw4;
new Text:Textdraw5;
new PlayerText:Textdraw6[MAX_PLAYERS];
new PlayerText:Textdraw7[MAX_PLAYERS];
new PlayerText:Textdraw8[MAX_PLAYERS];
new PlayerText:Textdraw9[MAX_PLAYERS];
new PlayerText:Textdraw10[MAX_PLAYERS];
new PlayerText:Textdraw11[MAX_PLAYERS];
new PlayerText:Textdraw12[MAX_PLAYERS];
 
//speedo2
 
new Text:speedom0;
new Text:speedom1;
new Text:speedom2;
new PlayerText:speedom3[MAX_PLAYERS];
new PlayerText:speedom4[MAX_PLAYERS];
new PlayerText:speedom5[MAX_PLAYERS];
new PlayerText:speedom6[MAX_PLAYERS];
new PlayerText:speedom7[MAX_PLAYERS];
new PlayerText:speedom8[MAX_PLAYERS];
new PlayerText:speedom9[MAX_PLAYERS];
new PlayerText:speedom10[MAX_PLAYERS];
new PlayerText:speedom11[MAX_PLAYERS];
new PlayerText:speedom12[MAX_PLAYERS];
new PlayerText:speedom13[MAX_PLAYERS];
new PlayerText:speedom14[MAX_PLAYERS];
new PlayerText:speedom15[MAX_PLAYERS];
new PlayerText:speedom16[MAX_PLAYERS];
new Text:speedom17;
new Text:speedom18;
new Text:speedom19;
new PlayerText:speedom20[MAX_PLAYERS];
new PlayerText:speedom21[MAX_PLAYERS];
new PlayerText:speedom22[MAX_PLAYERS];
new Text:speedom23;
 
//speed02
new Text:speedm0;
new Text:speedm1;
new PlayerText:speedm2[MAX_PLAYERS];
new Text:speedm3;
new PlayerText:speedm4[MAX_PLAYERS];
new PlayerText:speedm5[MAX_PLAYERS];
new Text:speedm6;
new PlayerText:speedm7[MAX_PLAYERS];
new PlayerText:speedm8[MAX_PLAYERS];
new PlayerText:speedm9[MAX_PLAYERS];
new PlayerText:speedm10[MAX_PLAYERS];
nice naming of variables.

all textdraws are global.

worst indentation.

lots of public functions - useless.

repeated code at lots of places.

untidy code and bad looking textdraws.

fix them all.
xMoBi is offline   Reply With Quote
Old 17/07/2018, 09:10 AM   #7
PgMNA
Little Clucker
 
Join Date: Nov 2017
Location: Pakistan,Karachi
Posts: 25
Reputation: 1
Default Re: Advance Double Speed-O-Meter [Version 2]

Quote:
Originally Posted by xMoBi View Post
Code:
//speedo1
new Text:Textdraw0;
new Text:Textdraw1;
new Text:Textdraw2;
new PlayerText:Textdraw3[MAX_PLAYERS];
new Text:Textdraw4;
new Text:Textdraw5;
new PlayerText:Textdraw6[MAX_PLAYERS];
new PlayerText:Textdraw7[MAX_PLAYERS];
new PlayerText:Textdraw8[MAX_PLAYERS];
new PlayerText:Textdraw9[MAX_PLAYERS];
new PlayerText:Textdraw10[MAX_PLAYERS];
new PlayerText:Textdraw11[MAX_PLAYERS];
new PlayerText:Textdraw12[MAX_PLAYERS];
 
//speedo2
 
new Text:speedom0;
new Text:speedom1;
new Text:speedom2;
new PlayerText:speedom3[MAX_PLAYERS];
new PlayerText:speedom4[MAX_PLAYERS];
new PlayerText:speedom5[MAX_PLAYERS];
new PlayerText:speedom6[MAX_PLAYERS];
new PlayerText:speedom7[MAX_PLAYERS];
new PlayerText:speedom8[MAX_PLAYERS];
new PlayerText:speedom9[MAX_PLAYERS];
new PlayerText:speedom10[MAX_PLAYERS];
new PlayerText:speedom11[MAX_PLAYERS];
new PlayerText:speedom12[MAX_PLAYERS];
new PlayerText:speedom13[MAX_PLAYERS];
new PlayerText:speedom14[MAX_PLAYERS];
new PlayerText:speedom15[MAX_PLAYERS];
new PlayerText:speedom16[MAX_PLAYERS];
new Text:speedom17;
new Text:speedom18;
new Text:speedom19;
new PlayerText:speedom20[MAX_PLAYERS];
new PlayerText:speedom21[MAX_PLAYERS];
new PlayerText:speedom22[MAX_PLAYERS];
new Text:speedom23;
 
//speed02
new Text:speedm0;
new Text:speedm1;
new PlayerText:speedm2[MAX_PLAYERS];
new Text:speedm3;
new PlayerText:speedm4[MAX_PLAYERS];
new PlayerText:speedm5[MAX_PLAYERS];
new Text:speedm6;
new PlayerText:speedm7[MAX_PLAYERS];
new PlayerText:speedm8[MAX_PLAYERS];
new PlayerText:speedm9[MAX_PLAYERS];
new PlayerText:speedm10[MAX_PLAYERS];
nice naming of variables.

all textdraws are global.

worst indentation.

lots of public functions - useless.

repeated code at lots of places.

untidy code and bad looking textdraws.

fix them all.
- see from open eyes not all textdraws are global.
- i have tested it and it doesnot drop fps.
- no repeated codes
- no untidy codes found you are the one who is a jelous peep nigga.
__________________
My Works:
Advance Double Speed-O-Meter
Discord: MNA#8254
PgMNA is offline   Reply With Quote
Old 17/07/2018, 09:46 AM   #8
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 92
Default Re: Advance Double Speed-O-Meter [Version 2]

Quote:
Originally Posted by PgMNA View Post
- see from open eyes not all textdraws are global.
- i have tested it and it doesnot drop fps.
- no repeated codes
- no untidy codes found you are the one who is a jelous peep nigga.
People try to help you optimize you'r code and you'r being rude to them.

also you should calculate the vehicle health

when the vehicle will be on fire the health will show between 0-250 and i usually prefer when the max health is 100 not 1000.

PHP Code:
GetVehicleHP(vehicleid)
{
    new 
veh_hp_resultFloat:veh_hp;
    
GetVehicleHealth(vehicleidveh_hp);
    
veh_hp_result floatround((floatsub(veh_hp250))/7.5);
    if(
veh_hp_result 0) return veh_hp_result;
    return 
0;

__________________
Lokii is offline   Reply With Quote
Old 17/07/2018, 10:10 AM   #9
PgMNA
Little Clucker
 
Join Date: Nov 2017
Location: Pakistan,Karachi
Posts: 25
Reputation: 1
Default Re: Advance Double Speed-O-Meter [Version 2]

Quote:
Originally Posted by Lokii View Post
People try to help you optimize you'r code and you'r being rude to them.

also you should calculate the vehicle health

when the vehicle will be on fire the health will show between 0-250 and i usually prefer when the max health is 100 not 1000.

PHP Code:
GetVehicleHP(vehicleid)
{
    new 
veh_hp_resultFloat:veh_hp;
    
GetVehicleHealth(vehicleidveh_hp);
    
veh_hp_result floatround((floatsub(veh_hp250))/7.5);
    if(
veh_hp_result 0) return veh_hp_result;
    return 
0;

i am only being rude who talks shit.
like see you , you are telling the betterment of filterscript and giving suggestion but see him , theres no useless code or untidy work but he loves to talk shit.
__________________
My Works:
Advance Double Speed-O-Meter
Discord: MNA#8254
PgMNA is offline   Reply With Quote
Old 17/07/2018, 10:38 AM   #10
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 455
Reputation: 35
Default Re: Advance Double Speed-O-Meter [Version 2]

what are you even talking about?
CodeStyle175 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
[FilterScript] Advance Double Speed-O-Meter by MNA PgMNA Filterscripts 10 16/07/2018 04:49 PM
Speed-o-meter RomaNScripteR Server Support 2 22/07/2017 12:50 PM
[BUG] The Speed-o-Meter and Fuel-o-Meter is not appearing! [UNSOLVED!!!] Rand_Omar Help Archive 12 28/01/2011 02:17 PM


All times are GMT. The time now is 02:58 AM.


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