Jump to content

i need help with this script


SullyDawish

Recommended Posts

--revive script by: sRT, Richard C' Lugovoi
function revivePlayerFromPK(thePlayer, commandName, targetPlayer)
	--local theTeam = getPlayerTeam(thePlayer)

		--if (teamID==1 or teamID==2 or teamID==3 or teamID==47 or teamID==59) then
							--	if exports.global:hasItem(thePlayer, 70) then
                     --   exports.global:takeItem(thePlayer, 70)
								--	outputChatBox("You have revived And Take From You 500$", thePlayer, 0, 255, 0)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "Los Santos Fire Department" ) then
		if not (targetPlayer) then
			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Name / ID]", thePlayer, 255, 194, 14)
		else
			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
		    	if getElementData(targetPlayer, "dead") == 1 then  --  
				if exports.global:hasMoney(targetPlayer, 500) then -- tratment cost 
                     exports.global:takeMoney(targetPlayer, 500)  --  here what im tryin do charging the player $500 for the reviv
					 else 
					   outputChatBox("you dont have eanugh money to be treated ", targetPlayer, 0, 255, 0)
					triggerClientEvent(targetPlayer,"es-system:closeRespawnButton",targetPlayer end 
						if targetPlayer then
					--fadeCamera(thePlayer, true)
					--outputChatBox("Respawning...", thePlayer)
					if isTimer(changeDeathViewTimer) == true then
						killTimer(changeDeathViewTimer)
					end
					
					
					local x,y,z = getElementPosition(targetPlayer)
					local int = getElementInterior(targetPlayer)
					local dim = getElementDimension(targetPlayer)
					local skin = getElementModel(targetPlayer)
					local team = getPlayerTeam(targetPlayer)
					
					setPedHeadless(targetPlayer, false)
					setCameraInterior(targetPlayer, int)
					setCameraTarget(targetPlayer, targetPlayer)
					setElementData(targetPlayer, "dead", 0)	 
					spawnPlayer(targetPlayer, x, y, z, 0)--, team)
					--(team ~= "Los Santos Emergency Services")
					
					setElementModel(targetPlayer,skin)
					setPlayerTeam(targetPlayer, team)
					setElementInterior(targetPlayer, int)
					setElementDimension(targetPlayer, dim)
					triggerEvent("updateLocalGuns", targetPlayer)
					--local adminTitle = tostring(exports.global:getPlayerAdminTitle(thePlayer))
					outputChatBox("Medic"..tostring(getPlayerName(thePlayer):gsub("_"," ")).." has revived you", targetPlayer, 0, 255, 0)
					outputChatBox("you successfully revied  !! "..tostring(getPlayerName(targetPlayer):gsub("_"," "))..".", thePlayer, 0, 255, 0)
                
					outputChatBox("You have been revived And charged 500$", thePlayer, 0, 255, 0) -- here what im tryin output to the treated player 
					exports.global:sendMessageToAdmins("AdmCmd: "..getPlayerName(thePlayer).." mrevived "..tostring(getPlayerName(targetPlayer))..".")
					exports.logs:dbLog(thePlayer, 4, targetPlayer, "REVIVED from PK")
				else
					outputChatBox(tostring(getPlayerName(targetPlayer):gsub("_"," ")).." is not dead.", thePlayer, 255, 0, 0)
				end
			end
		end
	end
end
addCommandHandler("mrevive", revivePlayerFromPK, false, false)

-- /mrevive  system by sRT
function adminHeal(thePlayer, commandName, targetPlayer)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "Los Santos Fire Department" ) then  -- faction name
		local health = 100
		local targetPlayerName = getPlayerName(thePlayer):gsub("_", " ")
		if not (targetPlayer) then
			targetPlayer = thePlayer
		else
			targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
		end

			if exports.global:hasMoney(targetPlayer, 200) then -- treatment cost
                exports.global:takeMoney(targetPlayer, 200)  -- ^^^^^^^^^^^^
			    outputChatBox("You have been treated and charged 200$", targetPlayer, 0, 255, 0) -- output the cost
				else
				outputChatBox("You dont have eanugh money", targetPlayer, 0, 255, 0)
		end
		
		if targetPlayer then
			setElementHealth(targetPlayer, tonumber(health))
		--	outputChatBox("The Medic " .. thePlayerName .. " Has Treat You , Now Your Health : " .. getAlivePlayers .. " Health.", targetPlayer, 0, 255, 0)
			else
			triggerEvent("onPlayerHeal", targetPlayer, true)
			exports.logs:dbLog(thePlayer, 4, targetPlayer, "AHEAL "..health)
		end
	end
end
addCommandHandler("maheal", adminHeal, false, false) 

Hello guys , im stuck here and i really need help . 

what i, tryin do is making a Medic revive . evrey thing in this script works fine untill i add the 

if exports.global:hasMoney(targetPlayer, 500) then -- tratment cost 
                     exports.global:takeMoney(targetPlayer, 500)  --  here what im tryin do charging the player $500 for the reviv
					 else 
					   outputChatBox("you dont have eanugh money to be treated ", targetPlayer, 0, 255, 0)

===== 

here is the code working with no problems at all except it wont charge target player for the revive .


--revive script by:
function revivePlayerFromPK(thePlayer, commandName, targetPlayer)
	--local theTeam = getPlayerTeam(thePlayer)

		--if (teamID==1 or teamID==2 or teamID==3 or teamID==47 or teamID==59) then
							--	if exports.global:hasItem(thePlayer, 70) then
                     --   exports.global:takeItem(thePlayer, 70)
					--	outputChatBox("You have revived And Take From You 500$", thePlayer, 0, 255, 0)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "Los Santos Fire Department" ) then
		if not (targetPlayer) then
			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Name / ID]", thePlayer, 255, 194, 14)
		else
			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
			
			if targetPlayer then
				if getElementData(targetPlayer, "dead") == 1 then
					triggerClientEvent(targetPlayer,"es-system:closeRespawnButton",targetPlayer)
					--fadeCamera(thePlayer, true)
					--outputChatBox("Respawning...", thePlayer)
					if isTimer(changeDeathViewTimer) == true then
						killTimer(changeDeathViewTimer)
					end
					
					
					local x,y,z = getElementPosition(targetPlayer)
					local int = getElementInterior(targetPlayer)
					local dim = getElementDimension(targetPlayer)
					local skin = getElementModel(targetPlayer)
					local team = getPlayerTeam(targetPlayer)
					
					setPedHeadless(targetPlayer, false)
					setCameraInterior(targetPlayer, int)
					setCameraTarget(targetPlayer, targetPlayer)
					setElementData(targetPlayer, "dead", 0)	 
					spawnPlayer(targetPlayer, x, y, z, 0)--, team)
					--(team ~= "Los Santos Emergency Services")
					
					setElementModel(targetPlayer,skin)
					setPlayerTeam(targetPlayer, team)
					setElementInterior(targetPlayer, int)
					setElementDimension(targetPlayer, dim)
					triggerEvent("updateLocalGuns", targetPlayer)
					--local adminTitle = tostring(exports.global:getPlayerAdminTitle(thePlayer))
					outputChatBox("The medic  "..tostring(getPlayerName(thePlayer):gsub("_"," ")).." has been revived you", targetPlayer, 0, 255, 0)
					outputChatBox("You have revived "..tostring(getPlayerName(targetPlayer):gsub("_"," "))..".", thePlayer, 0, 255, 0)
						--if exports.global:hasItem(thePlayer, 34) then
                      --  exports.global:takeItem(thePlayer, 34)
					--	outputChatBox("You have revived And Take From You 500$", thePlayer, 0, 255, 0)
					exports.global:sendMessageToAdmins("AdmCmd: "..getPlayerName(thePlayer).." mrevived "..tostring(getPlayerName(targetPlayer))..".")
					exports.logs:dbLog(thePlayer, 4, targetPlayer, "REVIVED from PK")
				else
					outputChatBox(tostring(getPlayerName(targetPlayer):gsub("_"," ")).." is not dead.", thePlayer, 255, 0, 0)
				end
			end
		end
	end
end
addCommandHandler("mrevive", revivePlayerFromPK, false, false)

-- /mrevive  system by sRT
function adminHeal(thePlayer, commandName, targetPlayer)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "Los Santos Fire Department" ) then  -- faction name 
		local health = 100
		local targetPlayerName = getPlayerName(thePlayer):gsub("_", " ")
		if not (targetPlayer) then
			targetPlayer = thePlayer
		else
			targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
		end

			if exports.global:hasMoney(thePlayer, 200) then -- treatment cost
                exports.global:takeMoney(thePlayer, 200)  -- treatment cost 
			    outputChatBox("You have been revived and take from you 200$", targetPlayer, 0, 255, 0) -- output 
				else
				outputChatBox("You dont have money", targetPlayer, 0, 255, 0)
		end
		
		if targetPlayer then
			setElementHealth(targetPlayer, tonumber(health))
		--	outputChatBox("The Medic " .. targetPlayerName .. " Has Treat You , Now Your Health : " .. getAlivePlayers .. " Health.", thePlayer, 0, 255, 0)
			outputChatBox("The medic " .. targetPlayerName .. " has treat you  , now your health is : " .. health .. " health.", thePlayer, 0, 255, 0)
			else
			triggerEvent("onPlayerHeal", targetPlayer, true)
			exports.logs:dbLog(thePlayer, 4, targetPlayer, "AHEAL "..health)
		end
	end
end
addCommandHandler("maheal", adminHeal, false, false) 

 

===

im tryin charge the target player  $500 for the revive and output the charge .   it wont let me do it .  idont know how should i do this  can you guys please help me i dont have that much of experience  :(  :(:( 

Link to comment

حليت المشكله اشكر الي حاولو يساعدوني  ... 

 

نزلت الحل عشان الفائدة بس  .. شكرا 

 

--[[ -- ألإصدار القادم سيتم فتح هذا -
---addCommandHandler("alive", getAlivePlayers, false, false)
--function getAlivePlayers( alivePlayersList )
function alivePlayers( getAlivePlayers, alivePlayersList ) --()
if ( alivePlayers ) then -- if we got the table
    alivePlayersList = "none"
    -- Loop through the table
    for playerKey, playerValue in ipairs(alivePlayers) do
        -- add their name to the list
        if ( alivePlayersList == "none" ) then
            alivePlayersList = getPlayerName ( playerValue )
        else
            alivePlayersList = alivePlayersList .. ", " .. getPlayerName ( playerValue )
        end
    end
    outputChatBox ( alivePlayersList .. " : اللاعبين الذين هم على قيد الحياة: ")   -   
end
addCommandHandler("aaa" ,getAlivePlayers, alivePlayersList)
]]
--revive script by: sRT, Richard C' Lugovoi
function revivePlayerFromPK(thePlayer, commandName, targetPlayer)
	--local theTeam = getPlayerTeam(thePlayer)

		--if (teamID==1 or teamID==2 or teamID==3 or teamID==47 or teamID==59) then
							--	if exports.global:hasItem(thePlayer, 70) then
                     --   exports.global:takeItem(thePlayer, 70)
					--	outputChatBox("You have revived And Take From You 500$", thePlayer, 0, 255, 0)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "وزارة صحة بون كونتري" ) then
				if not (targetPlayer) then
			outputChatBox("SYNTAX: /" .. commandName .. " [Player Partial Name / ID]", thePlayer, 255, 194, 14)
		else
			local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
			
			if targetPlayer then
				if getElementData(targetPlayer, "dead") == 1 then
					triggerClientEvent(targetPlayer,"es-system:closeRespawnButton",targetPlayer)
					--fadeCamera(thePlayer, true)
					--outputChatBox("Respawning...", thePlayer)
					if isTimer(changeDeathViewTimer) == true then
						killTimer(changeDeathViewTimer)
					end
					
					
					local x,y,z = getElementPosition(targetPlayer)
					local int = getElementInterior(targetPlayer)
					local dim = getElementDimension(targetPlayer)
					local skin = getElementModel(targetPlayer)
					local team = getPlayerTeam(targetPlayer)
					
					setPedHeadless(targetPlayer, false)
					setCameraInterior(targetPlayer, int)
					setCameraTarget(targetPlayer, targetPlayer)
					setElementData(targetPlayer, "dead", 0)	 
					spawnPlayer(targetPlayer, x, y, z, 0)--, team)
					--(team ~= "Los Santos Emergency Services")
					
					setElementModel(targetPlayer,skin)
					setPlayerTeam(targetPlayer, team)
					setElementInterior(targetPlayer, int)
					setElementDimension(targetPlayer, dim)
					triggerEvent("updateLocalGuns", targetPlayer)
					if exports.global:hasMoney(thePlayer, 200) then -- سعرالمعالجة
					exports.global:takeMoney(thePlayer, 200)  -- سعر المعالجة
					outputChatBox("You have been revived and take from you 200$", thePlayer, 0, 255, 0) -- رسالةتم اذ منك 200 ومعالجتك 
				else
					outputChatBox("You dont have money", thePlayer, 0, 255, 0)
					end
					outputChatBox("The medic  "..tostring(getPlayerName(thePlayer):gsub("_"," ")).." has been revived you", targetPlayer, 0, 255, 0)
					outputChatBox("You have revived "..tostring(getPlayerName(targetPlayer):gsub("_"," "))..".", thePlayer, 0, 255, 0)
					--	if exports.global:hasItem(thePlayer, 34) then
                     --  exports.global:takeItem(thePlayer, 34)
					--	outputChatBox("You have revived And Take From You 500$", thePlayer, 0, 255, 0)
					exports.global:sendMessageToAdmins("AdmCmd: "..getPlayerName(thePlayer).." mrevived "..tostring(getPlayerName(targetPlayer))..".")
					exports.logs:dbLog(thePlayer, 4, targetPlayer, "REVIVED from PK")
				else
					outputChatBox(tostring(getPlayerName(targetPlayer):gsub("_"," ")).." is not dead.", thePlayer, 255, 0, 0)
				end
			end
		end
	end
end
addCommandHandler("mrevive", revivePlayerFromPK, false, false)

-- /mrevive  system by sRT
function adminHeal(thePlayer, commandName, targetPlayer)
		if getPlayerTeam( thePlayer ) == getTeamFromName( "وزارة صحة بون كونتري" ) then  -- اسم الفاكشن
		local health = 100
		local targetPlayerName = getPlayerName(thePlayer):gsub("_", " ")
		if not (targetPlayer) then
			targetPlayer = thePlayer
		else
			targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer)
		end

			if exports.global:hasMoney(targetPlayer, 200) then -- سعرالمعالجة
                exports.global:takeMoney(targetPlayer, 200)  -- سعر المعالجة
			    outputChatBox("لقد تمت معالجتك من قبل المسعف واخذ مبلغ $200", targetPlayer, 0, 255, 0) -- رسالةتم اذ منك 200 ومعالجتك 
				else
				outputChatBox("لايوجد لديك المال الكافي لي علاجك", targetPlayer, 0, 255, 0)
		end
		
		if targetPlayer then
			setElementHealth(targetPlayer, tonumber(health))
		--	outputChatBox("The Medic " .. targetPlayerName .. " Has Treat You , Now Your Health : " .. getAlivePlayers .. " Health.", thePlayer, 0, 255, 0)
			outputChatBox("المسعف " .. thePlayer .. " قام بمعالجتك طاقتك الان : " .. health .. " الطاقة.", targetPlayer, 0, 255, 0)
			else
			triggerEvent("onPlayerHeal", targetPlayer, true)
			exports.logs:dbLog(thePlayer, 4, targetPlayer, "AHEAL "..health)
		end
	end
end
addCommandHandler("maheal", adminHeal, false, false) -- ألتكملةالحلقة القادمة sRT, Richard C' Lugovoi

 

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