syxx1337 Posted January 19, 2018 Share Posted January 19, 2018 (edited) Hello! I want to restart a resource if someone bought eg: phone but not at everyone, just want to restart resource the one person who bought the phone (so client-side maybe?!) It is possible? Edited January 19, 2018 by syxx1337 Link to comment
AHMED MOSTAFA Posted January 19, 2018 Share Posted January 19, 2018 (edited) 10 hours ago, syxx1337 said: Hello! I want to restart a resource if someone bought eg: phone but not at everyone, just want to restart resource the one person who bought the phone (so client-side maybe?!) It is possible? 10 hours ago, syxx1337 said: It is possible? ** No You Can not Edited January 19, 2018 by killerProject Link to comment
syxx1337 Posted January 19, 2018 Author Share Posted January 19, 2018 (edited) 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 Edited January 19, 2018 by syxx1337 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now