nasserdfdd Posted May 8, 2015 Share Posted May 8, 2015 hi all i have old medkit script i runned it it gave me this error client (nasser) triggered serverside event onclientsend, but event is not added serverside client local theMarker = createMarker ( 1176.1931152344, -1339.0891113281, 13.985934257507, "cylinder", 3, 0 255 0 ) function onMarkerHit () outputChatBox ("Type /med to buy 25% of Health") end addEventHandler ("onClientMarkerHit", onMarkerHit) function commandMed ( ) if ( getPlayerMoney ( localPlayer ) > 1499 ) then outputChatBox("You have bought 25% health for $1,500", 0, 255, 0) triggerServerEvent ( "setPlayerHealth", localPlayer ) end end addCommandHandler( "med", commandMed ) function setPlayerHealth ( ) local newHealth = getElementHealth ( source ) + 25 setElementHealth ( source, newHealth ) takPlayerMoney ( source, 1500 ) end addEvent ( "setPlayerHealth", true) addEventHandler ( "setPlayerHealth", root, setPlayerHealth) pls help Link to comment
Bilal135 Posted May 8, 2015 Share Posted May 8, 2015 server: function setPlayerHealth ( ) local newHealth = getElementHealth ( source ) setElementHealth ( source, newHealth+25 ) takePlayerMoney ( source, 1500 ) end addEvent ( "setPlayerHealth", true) addEventHandler ( "setPlayerHealth", root, setPlayerHealth) Link to comment
TAPL Posted May 8, 2015 Share Posted May 8, 2015 Server only, no need for the client. local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0 255 0) addEventHandler("onMarkerHit", theMarker, function(player) if getElementType(player) == "player" then outputChatBox("Type /med to buy 25% of Health", player, 255, 255, 255) end end) addCommandHandler("med", function(player) if getPlayerMoney(player) >= 1500 then local newHealth = getElementHealth(player) + 25 setElementHealth(player, newHealth) takePlayerMoney(player, 1500) outputChatBox("You have bought 25% health for $1,500", player, 0, 255, 0) end end) Link to comment
nasserdfdd Posted May 8, 2015 Author Share Posted May 8, 2015 Server only, no need for the client. local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0 255 0) addEventHandler("onMarkerHit", theMarker, function(player) if getElementType(player) == "player" then outputChatBox("Type /med to buy 25% of Health", player, 255, 255, 255) end end) addCommandHandler("med", function(player) if getPlayerMoney(player) >= 1500 then local newHealth = getElementHealth(player) + 25 setElementHealth(player, newHealth) takePlayerMoney(player, 1500) outputChatBox("You have bought 25% health for $1,500", player, 0, 255, 0) end end) error medicalkits\s_medkit.lua:1:>expected near 255 Link to comment
nasserdfdd Posted May 8, 2015 Author Share Posted May 8, 2015 server: function setPlayerHealth ( ) local newHealth = getElementHealth ( source ) setElementHealth ( source, newHealth+25 ) takePlayerMoney ( source, 1500 ) end addEvent ( "setPlayerHealth", true) addEventHandler ( "setPlayerHealth", root, setPlayerHealth) not working Link to comment
TAPL Posted May 8, 2015 Share Posted May 8, 2015 Comma is missing. local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0, 255, 0) Link to comment
nasserdfdd Posted May 8, 2015 Author Share Posted May 8, 2015 Comma is missing. local theMarker = createMarker(1176.19, -1339.09, 13.985, "cylinder", 3, 0, 255, 0) thanks u 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