Jump to content
Sign in to follow this  
bugerman

Give Item to Players using SQL Query

Recommended Posts

function sendid(role,cha,item_id,quantity)
	if(type(cha) ~= 'userdata') then
		cha = GetPlayerByName(cha)
	end
	--local cha = GetPlayerByName(cha)
	local gmname = GetChaDefaultName(role)
	if cha == nil then
		HelpInfo(role,0,"Player is offline or in another gameserver try again~!~")
		return 0 
	end
	
	if(cha ~= nil)then
		if HasLeaveBagGrid(cha, 1) ~= LUA_TRUE or KitbagLock(cha, 0) == LUA_FALSE then
			GiveItemX(cha, 0, item_id, quantity, 4)
			HelpInfoX(role,0,"Storage box:You gave Player ["..GetChaDefaultName(cha).."]["..GetItemName(item_id).."x["..quantity.."]")
			RefreshCha(cha)
		else
			MakeItem(cha,item_id,quantity,4)
			HelpInfoX(role,0,"You gave Player ["..GetChaDefaultName(cha).."]["..GetItemName(item_id).."x["..quantity.."]")
		end
		LG("send item to player", "GM ["..gmname.."]sent to  Player:["..GetChaDefaultName(cha).."], :["..GetItemName(item_id).."] ,quantity : " ..quantity.. "  :, successfuly")
		RefreshCha(cha)
	end	
	--RefreshCha(cha)
end

 

Share this post


Link to post
Share on other sites
13 minutes ago, mkhzaleh said:

function sendid(role,cha,item_id,quantity)
	if(type(cha) ~= 'userdata') then
		cha = GetPlayerByName(cha)
	end
	--local cha = GetPlayerByName(cha)
	local gmname = GetChaDefaultName(role)
	if cha == nil then
		HelpInfo(role,0,"Player is offline or in another gameserver try again~!~")
		return 0 
	end
	
	if(cha ~= nil)then
		if HasLeaveBagGrid(cha, 1) ~= LUA_TRUE or KitbagLock(cha, 0) == LUA_FALSE then
			GiveItemX(cha, 0, item_id, quantity, 4)
			HelpInfoX(role,0,"Storage box:You gave Player ["..GetChaDefaultName(cha).."]["..GetItemName(item_id).."x["..quantity.."]")
			RefreshCha(cha)
		else
			MakeItem(cha,item_id,quantity,4)
			HelpInfoX(role,0,"You gave Player ["..GetChaDefaultName(cha).."]["..GetItemName(item_id).."x["..quantity.."]")
		end
		LG("send item to player", "GM ["..gmname.."]sent to  Player:["..GetChaDefaultName(cha).."], :["..GetItemName(item_id).."] ,quantity : " ..quantity.. "  :, successfuly")
		RefreshCha(cha)
	end	
	--RefreshCha(cha)
end

 

Tnx

Edited by bugerman

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...