Jump to content

DNL291

Retired Staff
  • Posts

    3,875
  • Joined

  • Days Won

    67

Everything posted by DNL291

  1. Try this: Client addEventHandler("onClientPlayerDamage", localPlayer, function (attacker, weapon, bodypart, loss) local team = getPlayerTeam(attacker) if not team then return end if (attacker and getElementType(attacker) == "player" and weapon == 41 and getTeamName(team) == "Medic") then cancelEvent() if (not isTimer(pause)) then local health = getElementHealth(localPlayer) if (health < 99) then triggerServerEvent("medic:healing", localPlayer, attacker) pause = setTimer(function() end, 800, 1) end end end end) Server: addEventHandler("medic:healing", root, function (medic) if (getElementHealth(source) < 100) then local Heal = getElementHealth(source) + 11 -- New health setElementHealth(source, Heal) if (Heal > 100) then setElementHealth(source, 100) end local money = math.random(25, 50) givePlayerMoney(medic, money) takePlayerMoney(source, money) end end)
  2. @Saml1er you forgot to put attacker (theAttacker isn't defined) in givePlayerMoney function. Also, the player element is missing at getElementHealth and setElementHealth. And is missing an 'end' to close the function. And i don't think that will work, because of: local newHealth = 100 - targetCurrentHealth.
  3. Try this: local Lobby = createTeam("#006677 - Lobby | Welcome - ") local Missions = createTeam("#006677Missions | Co-Op") function SpawnPlayerToLobby(player,cmd) if source then bindKey(source, "F1", "down", "Lobby") fadeCamera(source, true) setPlayerTeam(source, Lobby) spawnPlayer(source, 493.45208740234, -23.21369934082, 1000, 0, 0, 17, 0) end if isElement(player) and getElementType(player) == "player" then spawnPlayer(player, 493.45208740234, -22.21369934082, 1000, 0, 0, 17, 0) setPlayerTeam(player, Lobby) fadeCamera(player, true) end end addEventHandler("onPlayerLogin", getRootElement(), SpawnPlayerToLobby) addCommandHandler("Lobby", SpawnPlayerToLobby) addEventHandler( "onPlayerJoin", root, function () addEventHandler("onPlayerLogin", source, SpawnPlayerToLobby) addCommandHandler("Lobby", SpawnPlayerToLobby) end )
  4. Is missing a comma in the manawydan's code after DanceTable[DanceP[player]] (line 28).
  5. for i, player in ipairs(getElementsByType("player")) do -- end
  6. getCameraMatrix getDistanceBetweenPoints3D getPedBonePosition isLineOfSightClear getScreenFromWorldPosition dxDrawText -- Event: "onClientRender"
  7. DNL291

    Easy Help!

    addEventHandler ( "onClientElementDataChange", getRootElement(), function (dataName) if dataName == "EXP" then guiSetText(TotalEXP, getElementData(source,"EXP")) elseif dataName == "Level" then guiSetText(Level, getElementData(source,"Level")) elseif dataName == "Bank" then guiSetText(Clan, getPlayerName(source)) guiSetText(BankMoney, getElementData(source,"Bank")) end end ) addEventHandler( "onClientPlayerChangeNick", localPlayer, function (_, newNick) guiSetText(Nickname, newNick) end )
  8. Try this: function onQuit () local account = getPlayerAccount(source) if account and not (isGuestAccount (account)) then setAccountData (account, "firstTime", tostring (getPlayerMoney (source))) end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit) function assigntheteam (old, acc) local acc = acc or getPlayerAccount(source) local firstTime = getAccountData(acc, 'firstTime') if not firstTime then setPlayerTeam(source, Unemployed) spawnPlayer(source, 1643.40002, -2249.10009, 13.300, 178.0004, 0, 0, 0, Unemployed) fadeCamera(source, true) setPlayerMoney ( source, 2000 ) setCameraTarget(source, source) setAccountData(acc, 'firstTime', 'true') else spawnPlayer(source, 1643.40002, -2249.10009, 13.300, 178.0004, 0, 0, 0) local playerMoney = getAccountData (acc, "firstTime") setPlayerMoney (source, tonumber(playerMoney)) fadeCamera(source, true) setCameraTarget(source, source) end end addEvent ( "IfNewPlayerJoin", true ) addEventHandler ( "IfNewPlayerJoin", getRootElement(), assigntheteam ) addEventHandler ("onPlayerLogin", getRootElement(), assigntheteam)
  9. setElementAlpha(getPlayerFromName("duduRastaman"), 0)
  10. You've putted the syntax arguments incorrect. guiGridListSetItemText(CarSpawner_Gridlist, row, 1, "-", false, true) guiGridListSetItemText(CarSpawner_Gridlist, row, 2, carName, false, true)
  11. Try using: setElementData(killer, "blood", 100)
  12. @#Twerky, Try this: function assigntheteam () setPlayerTeam ( source, Unemployed ) spawnPlayer(source, 1643.40002, -2249.10009, 13.300, 178.0004, 0, 0, 0, Unemployed) fadeCamera(source, true) setCameraTarget(source, source) end addEvent ( "IfNewPlayerJoin", true ) addEventHandler ( "IfNewPlayerJoin", getRootElement(), assigntheteam )
  13. Try using: fadeCamera(source, true)
  14. Try this: local sx, sy = guiGetScreenSize ( ) local x = (11.25*sx) /100 local y = (54.16*sy) /100 local button = guiCreateButton(x, y, 200, 40, "", false); If it's not the right position, show the x and y positions you've created the button.
  15. Yes, loop through all players on every render really isn't good. But, he could verify if the player job matches with "seadelivery" when the player hits the marker, or create that marker only for players with the element data corresponding with "seadelivery" when resource starts. And create that marker for the player who join this job.
  16. Well, if you've done a system for that (as you said), then ok. But keep in mind, if the max health stat is more than 569, then player's max health will be greater than 100%.
  17. Try: local maxRedCol = 255 local health = getElementHealth(player) local red = maxRedCol - ((health*255) /100) red = math.ceil(red) But you still have to adjust with getPedStat(thePlayer, 24), if player's health returns a value greater than 100.
  18. addEventHandler ( "onClientRender", getRootElement(), function( ) local notdutyplayers = getElementsByType("player") if (#notdutyplayers > 0) then for k,player in ipairs(notdutyplayers) do local pData = getElementData ( player, 'job' ) if not (pData == "seadelivery") then triggerEvent ( "destroyonleave", localPlayer ) end end end end) And where is deliveryMarker and deliveryBlip defined?
  19. DNL291

    Timers

    If you want to know the time left to execute the function, use: local remaining = getTimerDetails(theTimer) But if you want to know if the time stopped running, just use the attached function with setTimer (when it's called, means that the time stopped running).
  20. Tente usar setVehicleHandling pra ver se funciona (deve ser o elemento veículo em vez do ID). E deixe a velocidade máxima mais baixa (em torno de 1000 ~ 2000).
  21. DNL291

    expected near

    function returnLoginAjax(name) local account = getAccount(email, password) if (account ~= false) then if name == "true" then if (logIn(account, password) == true) then triggerClientEvent (player, "hideWindow", getRootElement()) end elseif name == "false" then triggerClientEvent (player, "unknownError", getRootElement()) end else triggerClientEvent (player, "loginWrong", getRootElement()) end end You must define the player element, and email/password if it's not defined.
  22. DNL291

    Easy Help!

    Using element data as xXMADEXx said, is the best and easiest way.
  23. Argument "time" is missing at moveObject, in event "onMarkerLeave". moveObject(object, 2500, 3283.3999023438, 261.10000610352, 14.10000038147)
×
×
  • Create New...