Haze Posted November 3, 2011 Share Posted November 3, 2011 Hi all how are You today i try to code this script is to make wanted lvl show up with Dx but when i start the script and i tape the command it dose not work help me plz function createText ( ) wantedLvl = getPlayerWantedLevel ( ) if wantedLvl == 0 then dxDrawText( wantedLvl, 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText( wantedLvl, 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) addCommandHandler ( "wanted", createText ) Link to comment
Aibo Posted November 3, 2011 Share Posted November 3, 2011 1. you forgot 2 ends 2. dx functions must be called every frame to be displayed (see onClientRender) 3. i dont even know what to say. Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 oh can u help with ur code plz Aibo Link to comment
12p Posted November 3, 2011 Share Posted November 3, 2011 (edited) We don't make fixed codes for the people here. We tell you what's wrong, you must fix it yourself. Edited November 3, 2011 by Guest Link to comment
TAPL Posted November 3, 2011 Share Posted November 3, 2011 (edited) function createText () addEventHandler ( "onClientRender", root, DrawText ) end addCommandHandler ( "wanted", createText ) function DrawText () wantedLvl = getPlayerWantedLevel() if wantedLvl == 0 then dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end Edited November 3, 2011 by Guest Link to comment
12p Posted November 3, 2011 Share Posted November 3, 2011 ...But sometimes there is people that breaks the idea of learning how to script, and give you the fixed code just like that. lol. Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 any way TAPL thx m8 but i try it its not working m8 thx any way Benxamix2 im learning but some Time i need Some Help i think u got Help too when u was Beginer Link to comment
Aibo Posted November 3, 2011 Share Posted November 3, 2011 first you should learn to close you functions and statements. Link to comment
TAPL Posted November 3, 2011 Share Posted November 3, 2011 huh? local screenWidth, screenHeight = guiGetScreenSize() function createText () addEventHandler ( "onClientRender", root, DrawText ) end addCommandHandler ( "wanted", createText ) function DrawText () wantedLvl = getPlayerWantedLevel() if wantedLvl == 0 then dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 dont post u must u must and u must just how i must learne what Function should i read and dont just put the wiki Link and say Go to Wiki Link to comment
Aibo Posted November 3, 2011 Share Posted November 3, 2011 the function you should learn, dear sir, is called "the basics of scripting". Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 dud nvm Im sry cause i post here omg i think u dont wana help pepole i will just wait for JR10 and Solidsnake14 Link to comment
Charlie_Jefferson Posted November 3, 2011 Share Posted November 3, 2011 i have script, it no work, help pls, me no no whi, Plz help, i lern lua son Promise men Help plz. u don wan hhelp me i wait snake YES! WE ARE EVIL WE NEVER HELP PEOPLE, MWAHAHAHAHA. If you want help, give us the debug error.. /debugscript 3 and start your script. Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 ERROR:dd\server.lua:9:attempt to perform arithmetic on global 'screenHeight' (a nill value) Link to comment
Charlie_Jefferson Posted November 3, 2011 Share Posted November 3, 2011 function createText () addEventHandler ( "onClientRender", root, DrawText ) end addCommandHandler ( "wanted", createText ) function DrawText () local screenHeight, screenWidth = guiGetScreenSize() wantedLvl = getPlayerWantedLevel() if wantedLvl == 0 then dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 dammn its not working m8 Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 no error m8 in the deubgscript i just get when i tape the command for the 2 time Render alerday handled and that because i tape it 2 time but there is not Error dammn m8 Link to comment
Charlie_Jefferson Posted November 3, 2011 Share Posted November 3, 2011 Eh. Means you gotta debug it yourself. If you don't get any error, than it sucks . Have fun, I guess. Link to comment
Charlie_Jefferson Posted November 3, 2011 Share Posted November 3, 2011 function displayText () local screenHeight, screenWidth = guiGetScreenSize() wantedLvl = getPlayerWantedLevel() if wantedLvl == 0 then dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end addEventHandler ( "onClientRender", root, displayText ) addCommandHandler ( "wanted", displayText ) Probably won't work, but try it Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 its not working lol Link to comment
12p Posted November 3, 2011 Share Posted November 3, 2011 Please read this: https://wiki.multitheftauto.com/wiki/Debugging Don't give him fixed code, please. He should learn by himself how to find errors and fix them. Link to comment
TAPL Posted November 3, 2011 Share Posted November 3, 2011 ERROR:dd\server.lua:9:attempt to perform arithmetic on global 'screenHeight' (a nill value) you didn't see my post ! if you say not work then you are crazy LOL local screenWidth, screenHeight = guiGetScreenSize() function createText () addEventHandler ( "onClientRender", root, DrawText ) end addCommandHandler ( "wanted", createText ) function DrawText () wantedLvl = getPlayerWantedLevel() if wantedLvl == 0 then dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 255, 0, 255 ), 1.02, "pricedown" ) else dxDrawText(tostring(wantedLvl), 44, screenHeight-41, screenWidth, screenHeight, tocolor ( 0, 255, 0, 255 ), 1.02, "pricedown" ) end end Link to comment
Haze Posted November 3, 2011 Author Share Posted November 3, 2011 Thx m8 its Working thx m8 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now