SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 19/05/2019, 08:46 PM   #11
DarkWorldJack
Little Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 22
Reputation: 0
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 19/05/2019, 11:26 PM   #12
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,184
Reputation: 384
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
I offer paid scripting services, I can do anything except mapping because fuck mapping.

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



Last edited by RogueDrifter; 19/05/2019 at 11:59 PM.
RogueDrifter is offline   Reply With Quote
Old 20/05/2019, 01:43 PM   #13
DarkWorldJack
Little Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 22
Reputation: 0
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, 01:55 PM   #14
Koreadars
Big Clucker
 
Join Date: Mar 2019
Location: Czech Republic, Prdelákov.
Posts: 123
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 online now   Reply With Quote
Old 01/06/2019, 07:04 PM   #15
DarkWorldJack
Little Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 22
Reputation: 0
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, 08:41 PM   #16
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 727
Reputation: 45
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:
jasperschellekens is offline   Reply With Quote
Old 02/06/2019, 09:35 AM   #17
DarkWorldJack
Little Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 22
Reputation: 0
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, 09:40 AM   #18
jasperschellekens
Gangsta
 
jasperschellekens's Avatar
 
Join Date: Dec 2016
Location: Gehenna
Posts: 727
Reputation: 45
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. 
jasperschellekens is offline   Reply With Quote
Old 22/06/2019, 09:25 PM   #19
DarkWorldJack
Little Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 22
Reputation: 0
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, 10:21 PM   #20
RogueDrifter
High-roller
 
RogueDrifter's Avatar
 
Join Date: Dec 2017
Location: SA-MP Drifting world.
Posts: 1,184
Reputation: 384
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
I offer paid scripting services, I can do anything except mapping because fuck mapping.

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


All times are GMT. The time now is 09:27 AM.


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