Jump to content

[HELP] Resource restart client side


syxx1337

Recommended Posts

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 by killerProject
Link to comment

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 by syxx1337
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...