Jump to content

jingzhi

Members
  • Posts

    288
  • Joined

  • Last visited

Everything posted by jingzhi

  1. jingzhi

    Problem

    Is there any error, how is it not working, and don't remove the outputChatBox because we can't see the problem without it
  2. Hello, I am a Chinese who is currently living in Madrid, I speak Chinese, English and Spanish. I have been in the forum for half a year and I found the Chinese sub forum is not very popular comparing to other language. I hope I can do something with this so I am here to apply for the moderator of the Chinese section. I have a advanced skill in lua, and am posting in the scripting forum frequently. I believe that I am the appropriate moderater for the Chinese section Greetings
  3. function ff() local pTeam = getPlayerTeam(source) local kTeam = getPlayerTeam(killer) if pTeam == kTeam then outputChatBox("You killed your team player",killer,255,0,0,true) end end
  4. jingzhi

    Problem

    levels = { 100, 200, 300, } maxlvl = 4 function givePlayerXP ( _,player) if not getElementData ( player, "xp" ) then setElementData(player,"xp",0) end if not getElementData(player,"level") then setElementData(player,"level",1) end local currXP = getElementData (player,"xp") local currLVL = getElementData(player,"level") setElementData(player,"xp",currXP + 10) outputChatBox ("+ 10 exp, current exp "..getElementData(player,"xp"), player, 255, 25, 0, true) if currLVL ~= 4 then if currXP >= levels[currLVL] then setElementData(player,"xp",getElementData(player,"xp") - levels[currLVL]) setElementData(player,"level",getElementData(player,"level") + 1) outputChatBox ("Rank up"..getElementData(player,"level"), player, 255, 25, 0, true) end end end addEventHandler("onPlayerWasted",root,givePlayerXP)
  5. jingzhi

    Problem

    Is there error or no
  6. You should use cancleEventHandler to cancle the event handler that attached to onClientRender to draw the image when you clicked certain button
  7. jingzhi

    Problem

    levels = { 100, 200, 300, } maxlvl = 4 function givePlayerXP ( _,player) if not getElementData ( player, "xp" ) then setElementData(player,"xp",0) end if not getElementData(player,"level") then setElementData(player,"level",1) end local currXP = getElementData (player,"xp") local currLVL = getElementData(player,"level") setElementData(player,"xp",currXP + 10) if currLVL ~= 4 then if currXP >= levels[currLVL] then setElementData(player,"xp",getElementData(player,"xp") - levels[currLVL]) setElementData(player,"level",getElementData(player,"level") + 1) outputChatBox ("Rank up"..getElementData(player,"level"), player, 255, 25, 0, true) end end end addEventHandler("onPlayerWasted",root,givePlayerXP)
  8. jingzhi

    WTF its wrong

    Blue, no offense, but you really need to explain your problem better if you want other people help you on your scripting, and dont accuse them not understanding your question
  9. [quote name=..&G:..]Hello guys, I got some problems with getSlotFromWeapon, it says that weapon-type was expected at argument 1, but got 47 (which is the weapon id) even in the wiki it says that the argument 1 should be the weapon id, not weapon type... function checkPlayerWeapons() for i = 1, 47 do if i ~= 40 then local weapSlot = i == 15 and 10 or getSlotFromWeapon(i) if getPedWeapon(localPlayer, weapSlot) == i then local ammo = getElementData(localPlayer, "safeWeapon" .. i) or 0 if ammo < 0 then ammo = 0 setElementData(localPlayer, "safeWeapon" .. i, 0, false) end What are you trying to do here?
  10. Well, I see the reason
  11. I think you shouldn't use elementData instead you should use the sql database for an inventory
  12. Can you show the error? Do you have you image in your xml file? Do you have your image with the right path?
  13. Can you show the error? Do you have you image in your xml file? Do you have your image with the right path?
  14. I am amazed you have 1700 + posts here and you don't know how to make this..... Create the function "createPoll" and make i return the poll element and start the timer. Use setElementData when people /vote, when time is up compare the 2 options "yes" and "no" to see which one has more vote
  15. Plus this script is not so hard, people need to realized that you need to stand on your own feet
  16. Dude, you really need to do it on yourself, you can't always rely on other people, specially when you are developing a server
  17. Dude, you can totally make you own script based on this idea
  18. Why dont you use the original one?
  19. I am not familiar with the sql funcions, i think you just retrive the data from sql data base, the current level and exp, for example you are level 7, and you have 200 exp. lvl 7 to lvl 8 needs 500 exp, so your position is 200 / 500. Now everytime you get exp you save it in sql database, and before that you do a calculation, see if the ammount of exp you got exceed the ammount needed to lvl up. For example you got 200 exp 500 - 200 = 300 ( the ammount of exp needed to lvl up) 300 - 200 = 100 so this havnt exceed the ammount of exp needed to lvl up. If you get 500 exp 500 - 300 = 200, the ammount of exp you got exceed by 200 of the ammount of exp you need. So you make this player lvl up and save it in database, and after lvl up add 200 to his current exp progress, e.g. now he is lvl 8 and he needs 800 to lvl up, now his pos is 200 / 800.
  20. I dont think this way of doing it is very good, because you are toggling the control every second using a timer. You should use this function only when the player's team changes
  21. The message is in the serverside function : triggerServerEvent ( "NGJobs->GivePlayerMoney", localPlayer, localPlayer, m, "You were paid $"..tostring(m).." for completing the flight path!" )
×
×
  • Create New...