IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 carspeed display error

 
mcoocr  
Posted: Sunday, Sep 23 2012, 20:57
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Sep 17, 2012

XXXXX



Hey guys,

I am new on gtaforums and this is my first Cleo mod.

Anyways ive got an error in there, when the car stands still it displays 0 but sometimes it switches to 1 for a second.

Ive tried to fix that by setting the $speed value to 0 if its 1 but that wont work at all. If i set $speed to anything higher like 3313 it works well and dont changes its display value?

PS: sorry for ugly post spoiler dont works

Greez~


CODE
{$CLEO .cs}

//-------------MAIN---------------
0000: NOP
0A95: enable_thread_saving

:DSP_1
wait 0
if and //im Auto?
   Actor.Driving($PLAYER_ACTOR)
   $ACTIVE_INTERIOR == 0
84C8: not actor $PLAYER_ACTOR driving_flying_vehicle
84A7: not actor $PLAYER_ACTOR driving_boat
jf @DSP_1
0811: 1@ = actor $PLAYER_ACTOR car //CarHandle speichern
03F0: enable_text_draw 1
jump @DSP_2

:DSP_2
wait 100
if and //im Auto?
   Actor.Driving($PLAYER_ACTOR)
   $ACTIVE_INTERIOR == 0
jf @DSP_3 //JUMP -> GXT löschen
02E3: 2@ = car 1@ speed
2@ *= 4.0 //FIX Geschwingkeit realistischer
0092: 3@ = float 2@ to_integer //FIX Float->Int
0004: $SPEED = 3@

if or
   $SPEED == 0
   $SPEED == 1
then //FIX Anzeige fehler 0~1
   $SPEED = 0
end

04F7: status_text $SPEED 0 1 'EINHEIT'
jump @DSP_2

:DSP_3
wait 0
03F0: enable_text_draw 0
0151: remove_status_text $SPEED
jump @DSP_1


This post has been edited by mcoocr on Sunday, Sep 23 2012, 21:00
PM
  Top
 

 
HeresOtis  
Posted: Sunday, Sep 23 2012, 22:07
Quote Post


Mark Chump
Group Icon
Group: Members
Joined: Apr 29, 2011

us.gif

XXXXX



You shouldn't use global variables ($SPEED) in CLEO scripts, as they can result in bugs/crashes.
I'll provide you with a high-structure version of the code, in which you should study upon.

CODE
{$CLEO}
0000:

while true
   wait 0
   if
       0256:   player $PLAYER_CHAR defined
   then
       if and
           00DF:   actor $PLAYER_ACTOR driving
           84A7:   not actor $PLAYER_ACTOR driving_boat
           84A9:   not actor $PLAYER_ACTOR driving_heli
           84AB:   not actor $PLAYER_ACTOR driving_plane
       then
           0811: 0@ = actor $PLAYER_ACTOR car_nosave
           
           while 00DF:   actor $PLAYER_ACTOR driving
               wait 0
               02E3: 1@ = car 0@ speed
               1@ *= 4.0
               0092: 2@ = float 1@ to_integer
               gosub @TextSettings
               045A: draw_text_1number 600.0 430.0 GXT 'NUMBER' number 2@  // ~1~
           end
           
           wait 250
           03F0: enable_text_draw 0
       end
   end
end

:TextSettings
03F0: enable_text_draw 1
03E4: enable_text_draw_align_right 1
0342: enable_text_draw_centered 0
0348: enable_text_draw_proportional 1
081C: draw_text_outline 1 RGBA 0 0 0 255            
return
PM
  Top
 

 
mcoocr  
Posted: Sunday, Sep 23 2012, 22:41
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Sep 17, 2012

XXXXX



Awesome, thank you very much!
PM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG