Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. No, I mean the script which sets the "Zombie Kills" account data.
  2. I tested the code and it works fine, if I set my "Zombie Kills" account data, it levels me up. Post the script where you are changing the "Zombie Kills" account data.
  3. Yes, I did change something. This line: I changed it to: I tested it and it fills the whole bar when my health is 100%.
  4. This script doesn't really make much sense to me, why would you use a timer to level up? you can use the onAccountDataChange event to detect when "Zombie Kills" data is changed. local levelCache = { } addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports.scoreboard:addScoreboardColumn ( 'Level' ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount ( player ) if ( not isGuestAccount ( account ) ) then local accName = getAccountName ( account ) levelCache [ accName ] = ( tonumber ( getAccountData ( account, "Level" ) ) or 1 ) setElementData ( player, "Level", levelCache [ accName ] ) end end end ) addEventHandler ( "onPlayerLogin", root, function ( _, account ) local accName = getAccountName ( account ) levelCache [ accName ] = ( tonumber ( getAccountData ( account, "Level" ) ) or 1 ) setElementData ( source, "Level", levelCache [ accName ] ) end ) addEventHandler ( "onAccountDataChange", root, function ( account, key, value ) local player = getAccountPlayer ( account ) if isElement ( player ) then if ( key == "Zombie Kills" ) then local value = ( tonumber ( value ) and tonumber ( value ) or 0 ) if ( value >= 0 and value < 50 ) then setAccountData ( account, "Level", 1 ) elseif ( value >= 50 and value < 150 ) then setAccountData ( account, "Level", 2 ) end elseif ( key == "Level" ) then local accName = getAccountName ( account ) local value = ( tonumber ( value ) and tonumber ( value ) or 0 ) if ( value > ( levelCache [ accName ] or 1 ) ) then outputChatBox ( getPlayerName ( player ) .." leveled up from ".. tostring ( levelCache [ accName ] or 1 ) .." to ".. tostring ( value ) ) givePlayerMoney ( player, 2000 ) -- Give money on level up. levelCache [ accName ] = value setElementData ( player, "Level", levelCache [ accName ] ) end end end end )
  5. local hpMin = 225 local hpMax = 135 local hpRate = ( ( hpMin - hpMax ) / 100 ) addEventHandler ( "onClientRender", root, function ( ) local hp = ( hpMin - ( getElementHealth ( localPlayer ) * hpRate ) ) dxDrawCircle ( 220, 796, 113, 16, 1, 134, 226, tocolor ( 0, 0, 0, 255 ) ) -- black bar background dxDrawCircle ( 220, 796, 112, 12, 1, hp, hpMin, tocolor ( 255, 0, 0, 255 ) ) -- red bar ( HP ) end ) Is that what you want?
  6. Post your current code.
  7. Have you tried to use WhoAmI's code? If you want it to be a full circle, change this variable: to 360 instead of 180.
  8. May I see the code that you are currently using?
  9. Castillo

    need help

    addEventHandler ( "onClientVehicleCollision", root, function ( hit ) if ( hit == localPlayer ) then setElementHealth ( localPlayer, 0 ) end end )
  10. he just use his calculations, I forever using this. and always I had success local stat = getPedStat ( getLocalPlayer(), 24 ) if stat < 1000 then dx.... else dx.... end So, your solution is to make a useless check, to draw the same thing no matter what "stat" is returning? You really should avoid posting if you don't know how to help, since you're only confusing the person who asked for help.
  11. Do you even check what you post? don't you see that both dxDrawCircle have the same arguments? and that "stat" is not being used anywhere but in that useless "if" statement?
  12. If you want it to be a full circle, then it has to be max angle 360, not 180 ( half circle ).
  13. Castillo

    Ayuda

    addCommandHandler ( "baseggc", function ( thePlayer ) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "G.G.C" ) ) then local toWarp = ( isPedInVehicle ( thePlayer ) and getPedOccupiedVehicle ( thePlayer ) or thePlayer ) setElementPosition ( toWarp, -2023.7476806641,-859.02844238281,32.171875, true ) end end )
  14. removeAccount And if you want to remove every account, you can use this function: getAccounts which returns a table, loop it and use removeAccount function.
  15. I don't see how calling someone "gay" is a joke. Neither the "question" Backflip made.
  16. Here is your problem, you are checking if the account already exists, then you add it, which makes no sense. Change these two lines to: local account = getAccount ( username ) if ( not account ) then
  17. An error such as that can stop parts of the script from working. Anyway, what is the problem? and, did you add the resource to the ACL group "Admin"? since addAccount requires ACL rights.
  18. May I redirect you to the forum rules: viewtopic.php?f=5&t=15740
  19. That's wrong, the function name is outputChatBox
  20. The error is because when you do this: not tonumber(rz), you are converting it to a boolean. You need to use parentheses, like this: if not ( tonumber ( rz ) > tonumber ( formula ) ) then
  21. Posteaste solo el client side, donde esta el server side?
×
×
  • Create New...