Jump to content

Execut command not it works


Recommended Posts

		elseif ( source == pages['home'].base_medic ) then
		executeCommandHandler("medic", ThePlayer)
function medicGO(source)
for i, player in ipairs(getElementsByType("player")) do
local uj = getElementData ( player, "Job" )== "Medic" or false
if type(uj) == "boolean" then
if uj == true then
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Samu",player, 255, 255, 255, true )
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa",player, 255, 255, 255, true )
end
end
end		
end
addCommandHandler("medic",medicGO)

--------------------------------------------------------------------

function Comandomedic ( ThePlayer )
outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFOs SAMU's Foram Avisados, Aguente firme", ThePlayer, 255, 255, 255, true )
end
addCommandHandler("medic", Comandomedic )

this would be on a cell phone, when the player clicks on the icon he calls a doctor.

but I can not make it work :c

Help me.

Link to comment
  • Scripting Moderators
1 hour ago, Gabriel Vasconcelos said:

		elseif ( source == pages['home'].base_medic ) then
		executeCommandHandler("medic", ThePlayer)

function medicGO(source)
for i, player in ipairs(getElementsByType("player")) do
local uj = getElementData ( player, "Job" )== "Medic" or false
if type(uj) == "boolean" then
if uj == true then
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Samu",player, 255, 255, 255, true )
outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa",player, 255, 255, 255, true )
end
end
end		
end
addCommandHandler("medic",medicGO)

--------------------------------------------------------------------

function Comandomedic ( ThePlayer )
outputMessage("#ffffff[ Aviso #ffffff] - #FFFFFFOs SAMU's Foram Avisados, Aguente firme", ThePlayer, 255, 255, 255, true )
end
addCommandHandler("medic", Comandomedic )

this would be on a cell phone, when the player clicks on the icon he calls a doctor.

but I can not make it work :c

Help me.

Try.

function medicGO(source)
	local players = getElementsByType("player")
	for i = 1, #players do
		local player = players[i]
		local player_job = getElementData(player, "Job") or false
		if player_job and player_job == "Medic" then
			outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Samu", player, 255, 255, 255, true)
			outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa", player, 255, 255, 255, true)
		end
	end
end
addCommandHandler("medic", medicGO)

EDIT: Why do u attach two functions to one command? You could do it in one.

Edited by majqq
Link to comment
5 hours ago, majqq said:

Try.


function medicGO(source)
	local players = getElementsByType("player")
	for i = 1, #players do
		local player = players[i]
		local player_job = getElementData(player, "Job") or false
		if player_job and player_job == "Medic" then
			outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFO Jogador #ffffff"..getPlayerName(source).." #ffffffChamou Por um Samu", player, 255, 255, 255, true)
			outputMessage("#ffffff[ Clientes #ffffff] - #FFFFFFDigite /Localizar "..getPlayerName(source).." #ffffffPara Marcar O Jogador No Mapa", player, 255, 255, 255, true)
		end
	end
end
addCommandHandler("medic", medicGO)

EDIT: Why do u attach two functions to one command? You could do it in one.

Yes there are two functions in a single command one for the player that enters the command and another for the doctor to receive

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...