syxx1337
Members-
Posts
7 -
Joined
-
Last visited
syxx1337's Achievements
Newbie (4/54)
0
Reputation
-
Hello! I have a problem with the damage script. I can't kill other players just if they got headshot.. but I don't know why. local playerInjuries = {} -- create a table to save the injuries function copy( t ) local r = {} if type(t) == 'table' then for k, v in pairs( t ) do r[k] = v end end return r end function isMelee( weapon ) return weapon and weapon <= 15 end function killknockedout(source) setElementHealth(source, 0) end function stabilize() if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source]['knockout'] then exports['global']:changeProtectedElementDataEx(source, "injuriedanimation") if isTimer(playerInjuries[source]['knockout']) then killTimer(playerInjuries[source]['knockout']) playerInjuries[source]['knockout'] = nil fadeCamera(source, true, 2) setPedAnimation(source) exports.ls_core:removeAnimation(source) toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) setElementHealth(source, math.max( 20, getElementHealth(source) ) ) end end if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) end end end addEvent( "onPlayerStabilize", false ) addEventHandler( "onPlayerStabilize", getRootElement(), stabilize ) addEvent "onPlayerHeadshot" addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if bodypart == 9 then if not getElementData(attacker, "sokkolokezeben") == true then local result = triggerEvent("onPlayerHeadshot", source, attacker, weapon, loss) if result == true then killPed(source, attacker, weapon, bodypart) setPedHeadless(source, true) end end end end ) function healInjuries(healed) if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source]['knockout'] then exports['global']:changeProtectedElementDataEx(source, "injuriedanimation") if isTimer(playerInjuries[source]['knockout']) then killTimer(playerInjuries[source]['knockout']) playerInjuries[source]['knockout'] = nil if healed then fadeCamera(source, true, 2) setPedAnimation(source) exports.global:removeAnimation(source) end end toggleAllControls(source, true, true, false) else if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', true) toggleControl(source, 'left', true) toggleControl(source, 'right', true) toggleControl(source, 'backwards', true) toggleControl(source, 'enter_passenger', true) toggleControl(source, 'enter_exit', true) end if playerInjuries[source][7] or playerInjuries[source][8] then toggleControl(source, 'sprint', true) toggleControl(source, 'jump', true) end if playerInjuries[source][5] and playerInjuries[source][6] then toggleControl(source, 'fire', true) end if playerInjuries[source][5] or playerInjuries[source][6] then toggleControl(source, 'aim_weapon', true) toggleControl(source, 'jump', true) end end playerInjuries[source] = nil end end addEvent( "onPlayerHeal", false ) addEventHandler( "onPlayerHeal", getRootElement(), healInjuries) function restoreInjuries( ) if playerInjuries[source] and not isPedHeadless(source) then if playerInjuries[source][7] and playerInjuries[source][8] then toggleControl(source, 'forwards', false) toggleControl(source, 'left', false) toggleControl(source, 'right', false) toggleControl(source, 'backwards', false) toggleControl(source, 'enter_passenger', false) toggleControl(source, 'enter_exit', false) end if playerInjuries[source][7] or playerInjuries[source][8] then toggleControl(source, 'sprint', false) toggleControl(source, 'jump', false) end if playerInjuries[source][5] and playerInjuries[source][6] then toggleControl(source, 'fire', false) end if playerInjuries[source][5] or playerInjuries[source][6] then toggleControl(source, 'aim_weapon', false) toggleControl(source, 'jump', false) end end end addEventHandler( "onPlayerStopAnimation", getRootElement(), restoreInjuries ) function resetInjuries() setPedHeadless(source, false) if playerInjuries[source] then healInjuries() end end addEventHandler( "onPlayerSpawn", getRootElement(), resetInjuries) addEventHandler( "onPlayerQuit", getRootElement(), resetInjuries)
-
Hello! So, I want to put +1 month from now to the mysql data but it's just insert current date (2018.01.24).. why?! date = string.format("%04d.%02d.%02d", time.year + 1900, time.month + 10, time.monthday ) dbExec(connection, "UPDATE Identity SET expires=? WHERE value = ?", date,itemValue)
-
Ah, okay.. thanks... just because I have an item and a phone script and want to do that can call other person without restart the item script or reconnect to the server... So if you buy the phone from the shop you need to restart the item script or reconnect to the server for the phone works. if not then others cant call you... you always got this message: "[ERROR] Phone number not found!" I posted below the codes, hope you or someone can help me. function callTargetInServer(playerSource, number, playerNumber) if number then targetPlayer = callMember(number) if targetPlayer ~= false and targetPlayer ~= "inCall" then triggerClientEvent(targetPlayer, "showMenu", targetPlayer, playerNumber, 6, playerSource, number) triggerClientEvent(playerSource, "showMenu", playerSource, number, 7, targetPlayer, playerNumber) triggerClientEvent(targetPlayer, "showSound", targetPlayer) exports.mta_chat:sendLocalDoAction(targetPlayer, " 's phone rings") elseif targetPlayer == "inCall" then outputChatBox("#D64541[ERROR] #ffffffThis number Already in call!", playerSource,255,255,255,true) else outputChatBox("#D64541[ERROR] #ffffffPhone number not found!", playerSource,255,255,255,true) end end end addEvent("callTargetInServer", true) addEventHandler("callTargetInServer", getRootElement(), callTargetInServer) function callMember(number) for k, v in ipairs(getElementsByType("player")) do if v and number and exports.mta_item:hasItemS(v, 47, number) then if (getElementData(v, "inCall")) then --setElementData(v, "inCall", false) return "inCall" else return v end end end return false end function checkNumber(phoneNumber) local checkID = dbPoll(dbQuery(connection, "SELECT * FROM phones"), -1) if (checkID) then for k, v in ipairs(checkID) do if (tonumber(v["number"]) == tonumber(phoneNumber)) then return true end end end return false end
