SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/05/2019, 09:46 PM   #11
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Help TextDraws

Quote:
Originally Posted by Koreadars View Post
This will be really slow, use switch. If you want to help him, help him correctly.
pawn Code:
switch(health){
    case 1000: {}
    case 900 .. 999: {}
    //...
}
Thanks, but RogueDrifter, not to defend him, we would miss him, but he gave an example ...
anyway I used what you wrote, because as you said it is more correct and faster
DarkWorldJack is offline   Reply With Quote
Old 20/05/2019, 12:26 AM   #12
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,190
Reputation: 406
Default Re: Help TextDraws

Quote:
Originally Posted by Koreadars View Post
This will be really slow, use switch. If you want to help him, help him correctly.
pawn Code:
switch(health){
    case 1000: {}
    case 900 .. 999: {}
    //...
}
Blow me, hard and fast.

Don't use what he said, it loops through every digit and he didn't specify the float values so that's even worse, for a case of checking values between numbers such as vehicle health ranging between hundreds and thousands use the if /else if statement and not switch case.
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link


Last edited by RogueDrifter; 20/05/2019 at 12:59 AM.
RogueDrifter is offline   Reply With Quote
Old 20/05/2019, 02:43 PM   #13
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Help TextDraws

Quote:
Originally Posted by RogueDrifter View Post
Blow me, hard and fast.

Don't use what he said, it loops through every digit and he didn't specify the float values so that's even worse, for a case of checking values between numbers such as vehicle health ranging between hundreds and thousands use the if /else if statement and not switch case.
I don't use the code he said, I put what you said and you and that's fine ... For 'Asta_Km' how can I do? I know you have to use Rot ... but when I insert it I don't work, it flashes and remains still and it doesn't even show
DarkWorldJack is offline   Reply With Quote
Old 20/05/2019, 02:55 PM   #14
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 122
Reputation: 6
Default Re: Help TextDraws

Quote:
Originally Posted by RogueDrifter View Post
Blow me, hard and fast.

Don't use what he said, it loops through every digit and he didn't specify the float values so that's even worse, for a case of checking values between numbers such as vehicle health ranging between hundreds and thousands use the if /else if statement and not switch case.
Did you ever work correctly with switch? I have a feeling you didn't. This is much faster than your way.
Koreadars is offline   Reply With Quote
Old 01/06/2019, 08:04 PM   #15
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Help TextDraws

Quote:
Originally Posted by RogueDrifter View Post
Blow me, hard and fast.

Don't use what he said, it loops through every digit and he didn't specify the float values so that's even worse, for a case of checking values between numbers such as vehicle health ranging between hundreds and thousands use the if /else if statement and not switch case.
This is my current one:
Code:
if (velocity> = 0) TextDrawSetPreviewRot (Asta_km [playerid], 0, velocity + 70, 0, 1);
else if (velocity> 220) TextDrawSetPreviewRot (Asta_km [playerid], 0, 300, 0, 1);
TextDrawShowForPlayer (playerid, Asta_km [playerid]);
when I'm in game you can't see and nothing works ...

This is the textdraw:
Code:
Asta_km [playerid] = TextDrawCreate (553.137939, 391.415832, "LD_SPAC: white");
TextDrawLetterSize (Asta_km [playerid], 0.032327, -0.186664);
TextDrawTextSize (Asta_km [playerid], -32.890174, -2.216660);
TextDrawAlignment (Asta_km [playerid], 1);
TextDrawColor (Asta_km [playerid], -5963521);
TextDrawUseBox (Asta_km [playerid], true);
TextDrawBoxColor (Asta_km [playerid], 0x00000000);
TextDrawBackgroundColor (Asta_km [playerid], 0x00000000);
TextDrawFont (Asta_km [playerid], 5);
TextDrawSetPreviewModel (Asta_km [playerid], 19348);
TextDrawSetPreviewRot (Asta_km [playerid], 0.0, 70.0, 0.0, 1.0);
I'd like it to become like this


the yellow one moved, but I don't understand how I can do it
DarkWorldJack is offline   Reply With Quote
Old 01/06/2019, 09:41 PM   #16
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 787
Reputation: 79
Default Re: Help TextDraws

I made a similar system, also a speedometer.
I just have a few meters predefined as sprites and update them based on speed:
PHP Code:
if(value >= && value <= 4TextDrawShowForPlayer(playeridSpeedoTD0mph);
        else if(
value >= && value <= 9TextDrawShowForPlayer(playeridSpeedoTD5mph);
        else if(
value >= 10 && value <= 14TextDrawShowForPlayer(playeridSpeedoTD10mph);
        else if(
value >= 15 && value <= 19TextDrawShowForPlayer(playeridSpeedoTD15mph);
        else if(
value >= 20 && value <= 24TextDrawShowForPlayer(playeridSpeedoTD20mph);
// and like that it goes on untill 120mph 
This is the speedometer:


And this is for example SpeedoTD5mph:
__________________
Coming soon:

Undead Wasteland Roleplay - Heavily mapped desert zombie apocalypse roleplay
Discord
jasperschellekens is offline   Reply With Quote
Old 02/06/2019, 10:35 AM   #17
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Help TextDraws

Quote:
Originally Posted by jasperschellekens View Post
I made a similar system, also a speedometer.
I just have a few meters predefined as sprites and update them based on speed:
PHP Code:
if(value >= && value <= 4TextDrawShowForPlayer(playeridSpeedoTD0mph);
        else if(
value >= && value <= 9TextDrawShowForPlayer(playeridSpeedoTD5mph);
        else if(
value >= 10 && value <= 14TextDrawShowForPlayer(playeridSpeedoTD10mph);
        else if(
value >= 15 && value <= 19TextDrawShowForPlayer(playeridSpeedoTD15mph);
        else if(
value >= 20 && value <= 24TextDrawShowForPlayer(playeridSpeedoTD20mph);
// and like that it goes on untill 120mph 
This is the speedometer:


And this is for example SpeedoTD5mph:
How can I use it?
I didn't understand very well, SpeedoTD5mph etc ...
DarkWorldJack is offline   Reply With Quote
Old 02/06/2019, 10:40 AM   #18
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 787
Reputation: 79
Default Re: Help TextDraws

Well, let me try to explain it better. I have made multiple meters indicating the speed.
For example:
5mph, 10mph, 15mph.
I made them in Photoshop and then I added all of them as models/sprites to the server.
These are all layers in photoshop:


Then basically I hide them first and then show the right one based on the speed.
PHP Code:
if(value >= && value <= 9TextDrawShowForPlayer(playeridSpeedoTD5mph); // If player speed is between 5 and 9 mph. show the meter that points at 5mph. 
__________________
Coming soon:

Undead Wasteland Roleplay - Heavily mapped desert zombie apocalypse roleplay
Discord
jasperschellekens is offline   Reply With Quote
Old 22/06/2019, 10:25 PM   #19
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Help TextDraws

Quote:
Originally Posted by jasperschellekens View Post
Well, let me try to explain it better. I have made multiple meters indicating the speed.
For example:
5mph, 10mph, 15mph.
I made them in Photoshop and then I added all of them as models/sprites to the server.
These are all layers in photoshop:


Then basically I hide them first and then show the right one based on the speed.
PHP Code:
if(value >= && value <= 9TextDrawShowForPlayer(playeridSpeedoTD5mph); // If player speed is between 5 and 9 mph. show the meter that points at 5mph. 
Isn't there an easier way to get it running?

But with 'SetPreviewRot' is it possible to create it as in the yellow image?
DarkWorldJack is offline   Reply With Quote
Old 22/06/2019, 11:21 PM   #20
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,190
Reputation: 406
Default Re: Help TextDraws

Quote:
Originally Posted by jasperschellekens View Post
I made a similar system, also a speedometer.
I just have a few meters predefined as sprites and update them based on speed:
PHP Code:
if(value >= && value <= 4TextDrawShowForPlayer(playeridSpeedoTD0mph);
        else if(
value >= && value <= 9TextDrawShowForPlayer(playeridSpeedoTD5mph);
        else if(
value >= 10 && value <= 14TextDrawShowForPlayer(playeridSpeedoTD10mph);
        else if(
value >= 15 && value <= 19TextDrawShowForPlayer(playeridSpeedoTD15mph);
        else if(
value >= 20 && value <= 24TextDrawShowForPlayer(playeridSpeedoTD20mph);
// and like that it goes on untill 120mph 
This is the speedometer:


And this is for example SpeedoTD5mph:
Wow, i want that speedometer, send source code pls
__________________
Quote:
Originally Posted by Andy
My anti cheat is still relevant *puts shades on* https://github.com/RogueDrifter/Anti_cheat_pack

[Github]:Link [Gists]:Link [Forum]:Link [Server]:Link [Discord]:Link

RogueDrifter 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] Textdraws tips (GTA V Textdraws...) adri1 Filterscripts 28 02/01/2018 02:24 AM
Global textdraws or player textdraws? Dreyfuz Scripting Help 3 08/08/2015 10:13 AM
Global TextDraws on top of Player TextDraws [resolved] Joe Staff Scripting Help 0 17/05/2013 06:35 AM
[BUG] Selecting textdraws lighting up multiple textdraws Hiddos Scripting Help 3 24/03/2012 03:44 PM
[TEXTDRAWS] Textdraws mixed up KnooL Help Archive 22 23/06/2010 03:52 PM


All times are GMT. The time now is 05:10 AM.


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