-
Posts
2,973 -
Joined
-
Last visited
-
Days Won
3
Everything posted by 50p
-
Your code will not work TheRealCow... For couple of reasons: - addEventHandler ( "onMarkerHit", marker, entering ) will be executed before the actual marker is created. - DO NOT ever add source as function parameter.. You will get into issues that you wouldn't want if that function gets longer and other features are added to the function. This is not actually a reason why it won't work but an advice for you. Also, if you expect player to be the element that hit the marker, make sure the element is player because getPlayerMoney will give warning if the element that hit the marker is vehicle (or player is inside vehicle). This should still work but if you release your resource always make sure it doesn't output any error/warning message because it's annoying if someone debugs his script and sees warning/error messages coming up from different resource. And as m4sje said, you need to add an if statement to check if player's health is not full because you don't want to be charged $100 for nothing.
-
You can try this resource: https://community.multitheftauto.com/index.html?p ... ils&id=614
-
Updated the code in post above.
-
Not a subforum but you missed forum completely... We don't deal with SA-MP in ANY WAY. So you better find SA-MP forum yourself.
-
OK, just tested and found out that getPedStat returns 569 not as I expected it to return value of what max health you see on the health bar. Use this code then: local maxHealth = 100; -- get max health stat local colourPercent = ( health / maxHealth ) * 255; local red, green; -- we don't need blue because we don't use it, it'll be 0 if health < ( maxHealth / 2 ) then red = 255; green = ( health / 50 ) * ( colourPercent * 2 ); else green = 255; red = 255 - ( ( health - 50 ) / 50 ) * 255; end local color = tocolor( red, green, 0, 150 );
-
Do you know what you're talking about? Both of them are correct. There is no local player on server-side.
-
I made a dynamic colour change health bar for a Flash game long time ago (college project), I'll port it to Lua for you: local health = getElementHealth( getLocalPlayer( ) ); local maxHealth = getPedStat( getLocalPlayer(), 24 ); -- get max health stat local colourPercent = ( health / maxHealth ) * 255; local red, green; -- we don't need blue because we don't use it, it'll be 0 if health < ( maxHealth / 2 ) then red = 255; green = ( health / 50 ) * ( colorPercent * 2 ); else green = 255; red = 255 - ( ( health - 50 ) / 50 ) * 255; end local color = tocolor( red, green, 0, 150 ); -- Now, use this "color" variable instead your tocolor I haven't tested it but it should work just fine since it's a simple port from ActionScript to Lua. If you get some issues, tell me and I'll test it and fix it if necessary. I know for a fact, at first the colour was weird due to Flash colour transformation but it should work. As your health goes down, the colour will transform. The colour should change like so: Green (100%) -> Yellow (50%) -> Red (0%).
-
Ask them to type the command. They will triggerClientEvent and if you can hear the music after they type the command in, they can hear the music when you type the command in.
-
OMG! Who says that? Someone who doesn't look at the wiki at all... Don't tell him not to make his own function because you have no idea what you're talking about.
-
LOL It doesn't blink because you draw it, whether you have more than 25 of health or not. Both of your dxDrawRectangle pairs are the same. Change the colour and see the difference.
-
This example will draw "SOME TEXT" at the center of San Andreas (it's the place where haystack resource spawns you, if you didn't know): addEventHandler( "onClientRender", getRootElement(), function( ) local x, y = getScreenFromWorldPosition( 0, 0, 3 ); if x then dxDrawText( "SOME TEXT", x, y ); end end )
-
I guess you meant dxDrawText. You can draw the text in any place. Like race resource, it draws the name of vehicle at the place of pickups. All you need to do is know your position in 3D (x, y and z) and use getScreenFromWorldPosition to know where to draw the text.
-
Because you can't convert boolean to a number Find you one setAccountData where you change value of "wwacc.timesSpawned" and make sure the value is not boolean. The code you showed sets timesSpawned twice and in both cases it's 0. Find the line where you change it to true or false. It's not possible that account data changes by itself. So what does getAccountData( playerid, "wwacc.timesSpawned" ) return?
-
Can you open the database and check if the data is reset? Also, at what line do you get that message?
-
Yes, I do. But I only check if the player spawned already before their current visit. I'm fiddling with the element data now. It always says "attempt to compare number with boolean", again... It works fine when I first register and login. I can also disconnect and reconnect back, but when I restart the server, it resets. What should I do? Should I use set/getElementData and then save it with set/getAccountData then reset it back by reading from the file? I have no idea what you're talking about myself. Show us your current code and try to ask the questions again...
-
Well, if someone sees your posts, they won't even try to help you...
-
How do you expect people to help you if you call them idiots?
-
Somehow, to me Wear_Dead and Namorek sound the same...
-
How do you expect the script to load collision file if the script doesn't use function to load collision? https://wiki.multitheftauto.com/wiki/EngineReplaceCOL
-
You can only use http servers for resources/files to be downloaded from. https://wiki.multitheftauto.com/wiki/Ser ... web_server
