~Mr.Hassan Posted May 20, 2015 Share Posted May 20, 2015 Wellcome i have proplem For Code [03:51:17] ERROR: Client ([...]111<+Pr1**<) triggered serverside event Paunch, but event is not added serverside Client GUIEditor = { button = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.button[1] = guiCreateButton(207, 344, 115, 31, "Muscles 100000$", false) GUIEditor.button[2] = guiCreateButton(355, 344, 106, 33, "Skinny 50000$", false) GUIEditor.button[3] = guiCreateButton(485, 344, 111, 33, "Paunch 75000", false) GUIEditor.label[5] = guiCreateLabel(257, 180, 236, 19, "مود العضلات من قبل ...", false) end ) addEventHandler("onClientRender", root, function() dxDrawImage(172, 169, 456, 257, "progress.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(209, 212, 113, 129, "mus.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(358, 210, 103, 131, "n7ef.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(488, 209, 108, 132, "krs.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end ) addEventHandler ( "onClientGUIClick", root, function ( ) if source == GUIEditor.button[1] then triggerServerEvent("Muscles",getLocalPlayer()) end end ) ----------- addEventHandler ( "onClientGUIClick", root, function ( ) if source == GUIEditor.button[2] then triggerServerEvent("Skinny",getLocalPlayer()) end end ) ------------------ addEventHandler ( "onClientGUIClick", root, function ( ) if source == GUIEditor.button[3] then triggerServerEvent("Paunch",getLocalPlayer()) end end ) ------------------------------------------------ ------------------------------------------------ guiSetVisible(GUIEditor_Window[1],false) bindKey("F5","down", function ( ) guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) showCursor(guiGetVisible(GUIEditor_Window[1])) Opens() end) Server ... addEvent("Muscles", true) addEventHandler("Muscles", root, function ( ) takePlayerMoney(source,100000) local stat = getPedStat ( getLocalPlayer(), 23 ) if stat < 1000 then outputChatBox ( "You now own Muscles " ) end ) ------------------------------ addEvent("Skinny", true) addEventHandler("Skinny", root, function ( ) takePlayerMoney(source,50000) local stat = getPedStat ( getLocalPlayer(), 25 ) if stat < 1000 then outputChatBox("You now own Skinny ") end ) -------------------------- addEvent("Paunch", true) addEventHandler("Paunch", root, function ( ) takePlayerMoney(source,75000) local stat = getPedStat ( getLocalPlayer(), 21 ) if stat < 1000 then outputChatBox("You now own Paunch ") end ) Thnx Bay Link to comment
Walid Posted May 20, 2015 Share Posted May 20, 2015 are you serious "getLocalPlayer()" server side replace "getLocalPlayer()" with source here Link to comment
xXMADEXx Posted May 20, 2015 Share Posted May 20, 2015 are you serious "getLocalPlayer()" server side replace "getLocalPlayer()" with source here It's fine, he obviously a new scripter, don't need to be dramatic about it. The error is becoming the event Paunch is being called from the client script (using triggerServerEvent). To fix this, you need to add the event into the server-side script, using the following functions: - addEvent - addEventHandler Link to comment
Walid Posted May 20, 2015 Share Posted May 20, 2015 The error is becoming the event Paunch is being called from the client script (using triggerServerEvent). To fix this, you need to add the event into the server-side script, using the following functions: - addEvent - addEventHandler as i can see it's already add the problem in the meta.xml. Link to comment
~Mr.Hassan Posted May 21, 2015 Author Share Posted May 21, 2015 createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) addEventHandler( "onMarkerHit", myMarker, MarkerHit ) function MarkerHit() if getElemntType(source) 'Player' then setElementModel(thePlayer, 0) outputChatBox("You Now For Skin CJ",255,255,255,255) setTime(ElemntModel,300000,5) elseif end end outputChatBox"Error ....",255,255,255,255) ---------------------------------- addEvent("Muscles", true) addEventHandler("Muscles", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,100000) local stat = getPedStat( source, 23 ) if stat < 1000 then outputChatBox ( "You now own Muscles " ) elseif OutPutChatBox("You No Have Money") end ) ------------------------------ addEvent("Skinny", true) addEventHandler("Skinny", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)==0 then return end takePlayerMoney(source,50000) local stat = getPedStat( source, 25 ) if stat < 1000 then outputChatBox("You now own Skinny ") elseif OutPutChatBox("You No Have Money") end ) -------------------------- addEvent("Paunch", true) addEventHandler("Paunch", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)==0 then return end takePlayerMoney(source,75000) local stat = getPedStat( source, 21 ) if stat < 1000 then outputChatBox("You now own Paunch ") elseif OutPutChatBox("You No Have Money") end ) -------------------------------------------- addCommandHandler("CJ",ss) function ss() outputChatBox("The Mod By HassanMeke Skype : z3im-mt2sm...") end -------------------------------------------------- addCommandHandler("scj",ss) function ss() outputChatBox("Skin ... ") end --------------------------------------------------------- Well I've changed everything and I did not code runs I hope the solution ?? Link to comment
Moderators IIYAMA Posted May 22, 2015 Moderators Share Posted May 22, 2015 It is: getElementType getElementModel outputChatBox and not: getElemntType isElementModel OutPutChatBox And don't tell me you don't see any warnings of that, because that would a lie. Unless your meta is incorrect... Link to comment
~Mr.Hassan Posted May 22, 2015 Author Share Posted May 22, 2015 ok createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) addEventHandler( "onMarkerHit", myMarker, MarkerHit ) function MarkerHit() if getElementType(source) 'Player' then setElementModel(thePlayer, 0) outputChatBox("You Now For Skin CJ",255,255,255,255) setTime(getElementModel,300000,5) elseif end end outputChatBox"Error ....",255,255,255,255) ----------------------- addEvent("Muscles", true) addEventHandler("Muscles", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)==0 then return end takePlayerMoney(source,100000) if setPedStat(source, 23, 999) then outputChatBox ( "You now own Muscles " ) elseif outputChatBox("You No Have Money") end end ) ------------------------------ addEvent("Skinny", true) addEventHandler("Skinny", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,50000) if setPedStat(source, 25, 999) then outputChatBox("You now own Skinny ") elseif outputChatBox("You No Have Money") end end ) -------------------------- addEvent("Paunch", true) addEventHandler("Paunch", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,75000) if setPedStat(source, 21, 999) then outputChatBox("You now own Paunch ") elseif outputChatBox("You No Have Money") end end ) -------------------------------------------- addCommandHandler("CJ",ss) function ss() outputChatBox("The Mod By HassanMeke Skype : z3im-mt2sm...") end -------------------------------------------------- addCommandHandler("scj",ss) function ss() outputChatBox("اذا تريد ان تاخذ شخصيه سي جي اذهب الى النقطه الحمراء في مدينه الملاهي والمس الدائره وستصبه بشخصيه سي جي ") end --------------------------------------------------------- Link to comment
Walid Posted May 22, 2015 Share Posted May 22, 2015 Many things wrong in your code Example: 1) Here you are trying to check if the marker == player , because the source of this event onMarkerHit is the marker that got hited by the element. Wrong: Correct: local myMarker = createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) function MarkerHit(player,Dim) if (Dim and isElement(player) and getElementType(player) == "player") then -- You code here end end 2) There is no function called isElementModel Wrong: Correct : local model = getElementModel(source) if model == 0 then -- Your code here end Link to comment
~Mr.Hassan Posted May 22, 2015 Author Share Posted May 22, 2015 (edited) createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) addEventHandler( "onMarkerHit", myMarker, MarkerHit ) function MarkerHit() local model = getElementModel(source) if model == 0 then if (Dim and isElement(player) and getElementType(player) == "player") then setElementModel(thePlayer, 0) outputChatBox("You Now For Skin CJ",255,255,255,255) setTime(getElementModel,300000,5) elseif end end outputChatBox"Error ....",255,255,255,255) ----------------------- addEvent("Muscles", true) addEventHandler("Muscles", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)==0 then return end takePlayerMoney(source,100000) if setPedStat(source, 23, 999) then outputChatBox ( "You now own Muscles " ) elseif outputChatBox("You No Have Money") end end ) ------------------------------ addEvent("Skinny", true) addEventHandler("Skinny", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,50000) if setPedStat(source, 25, 999) then outputChatBox("You now own Skinny ") elseif outputChatBox("You No Have Money") end end ) -------------------------- addEvent("Paunch", true) addEventHandler("Paunch", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,75000) if setPedStat(source, 21, 999) then outputChatBox("You now own Paunch ") elseif outputChatBox("You No Have Money") end end ) -------------------------------------------- addCommandHandler("CJ",ss) function ss() outputChatBox("The Mod By HassanMeke Skype : z3im-mt2sm...") end -------------------------------------------------- addCommandHandler("scj",ss) function ss() outputChatBox("اذا تريد ان تاخذ شخصيه سي جي اذهب الى النقطه الحمراء في مدينه الملاهي والمس الدائره وستصبه بشخصيه سي جي ") end --------------------------------------------------------- Proplem : if setPedStat(source, 21, 999) then Do not give me muscles or abdomen or Skinny Edited May 22, 2015 by Guest Link to comment
~Mr.Hassan Posted May 22, 2015 Author Share Posted May 22, 2015 Nonsense. No one asked your opinion Link to comment
Moderators IIYAMA Posted May 22, 2015 Moderators Share Posted May 22, 2015 Ey horse guy, are you even listening to me? Link to comment
Mann56 Posted May 22, 2015 Share Posted May 22, 2015 createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) addEventHandler( "onMarkerHit", myMarker, MarkerHit ) function MarkerHit() local model = getElementModel(source) if model == 0 then if (Dim and isElement(player) and getElementType(player) == "player") then setElementModel(thePlayer, 0) outputChatBox("You Now For Skin CJ",255,255,255,255) setTime(getElementModel,300000,5) elseif end end outputChatBox"Error ....",255,255,255,255) ----------------------- addEvent("Muscles", true) addEventHandler("Muscles", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)==0 then return end takePlayerMoney(source,100000) if setPedStat(source, 23, 999) then outputChatBox ( "You now own Muscles " ) elseif outputChatBox("You No Have Money") end end ) ------------------------------ addEvent("Skinny", true) addEventHandler("Skinny", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,50000) if setPedStat(source, 25, 999) then outputChatBox("You now own Skinny ") elseif outputChatBox("You No Have Money") end end ) -------------------------- addEvent("Paunch", true) addEventHandler("Paunch", root, function ( ) outputChatBox ( "Only SKin CJ ( ID : 0)" ) if isElementModel(source)== 0 then return end takePlayerMoney(source,75000) if setPedStat(source, 21, 999) then outputChatBox("You now own Paunch ") elseif outputChatBox("You No Have Money") end end ) -------------------------------------------- addCommandHandler("CJ",ss) function ss() outputChatBox("The Mod By HassanMeke Skype : z3im-mt2sm...") end -------------------------------------------------- addCommandHandler("scj",ss) function ss() outputChatBox("اذا تريد ان تاخذ شخصيه سي جي اذهب الى النقطه الحمراء في مدينه الملاهي والمس الدائره وستصبه بشخصيه سي جي ") end --------------------------------------------------------- Proplem : if setPedStat(source, 21, 999) then Do not give me muscles or abdomen or Skinny Because it's in the if condition and you do not give it to player but just 'check' that add setPedStat(source, 21, 999) at isElementModel(source)== 0 then return end takePlayerMoney(source,75000) in all three places muscles, skinny and paunch and is your meta fine? Link to comment
TAPL Posted May 22, 2015 Share Posted May 22, 2015 Nonsense. No one asked your opinion You posted on a public forum which mean you're asking for EVERYONE opinions. Don't want it, don't post. Your code not even close to be in working condition. Let's analyze the first 13 lines of your server side code. At line 1 you created a marker but without assigning a variable for it, also you didn't put the marker size argument. At line 2 you added the event onMarkerHit and attached it to undefined variable 'myMarker' and function does not exist 'MarkerHit'. At line 3 you have created the function 'MarkerHit', yet you have used it at line 2 that's why it considered as not exist. At line 4 you tried to get the model of the source, the source here is the marker and markers don't have model. At line 5 you compared the variable 'model' but you was getting the marker model and as been said, markers don't have model and it will return nil and it will never pass the comparison as nil does not equal to zero! At line 6 Dim and player is not defined. At line 7 thePlayer is not defined. At line 8 you didn't put a player element, visibleTo argument. Also you put 4 numbers for the color but the function require 3 only (r, g, b). Line 9 is nonsense. At line 10 you used elseif without the condition. There's 'end' missing. Line 13 is the same as line 8 plus its location is nonsense. Link to comment
Walid Posted May 22, 2015 Share Posted May 22, 2015 (edited) All What you need is At line 1 you created a marker but without assigning a variable for it, also you didn't put the marker size argument. local myMarker = createMarker(385.34344,2032.22693,7.83594 ,"cylinder",255,255,255,255) At line 2 you added the event onMarkerHit and attached it to undefined variable 'myMarker' and function does not exist 'MarkerHit'. addEventHandler( "onMarkerHit", myMarker, MarkerHit ) At line 3 you have created the function 'MarkerHit', yet you have used it at line 2 that's why it considered as not exist. function MarkerHit(player,Dim) -- Your code here end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) At line 4 you tried to get the model of the source, the source here is the marker and markers don't have model. local model = getElementModel(player) At line 5 you compared the variable 'model' but you was getting the marker model and as been said, markers don't have model and it will return nil and it will never pass the comparison as nil does not equal to zero! local model = getElementModel(player) if model == 0 then -- Your code here end At line 6 Dim and player is not defined. function MarkerHit(player,Dim) if (Dim and isElement(player) and getElementType(player) == "player") then -- You code here end end At line 7 thePlayer is not defined. setElementModel(player, 0) At line 8 you didn't put a player element, visibleTo argument. Also you put 4 numbers for the color but the function require 3 only (r, g, b). outputChatBox("CJ Skin",player,255,255,255,255) Edited May 22, 2015 by Guest Link to comment
Mann56 Posted May 22, 2015 Share Posted May 22, 2015 Dude that's 13 lines... And try to embed it in a function the model part Link to comment
~Mr.Hassan Posted May 22, 2015 Author Share Posted May 22, 2015 i am Need Stat , Muscles or belly .... But the code does not work and I just want the personal Cj actuation Link to comment
Moderators IIYAMA Posted May 22, 2015 Moderators Share Posted May 22, 2015 i am Need Stat , Muscles or belly ....But the code does not work and I just want the personal Cj actuation This is not a place for requests. You know what and how to fix your code, now do it! Move that lazy ass of yours. Link to comment
Mann56 Posted May 22, 2015 Share Posted May 22, 2015 i am Need Stat , Muscles or belly ....But the code does not work and I just want the personal Cj actuation We are not going to code for you. Nor fix the whole code you must know what you are doing . my advise go through the wiki again and don't miss out arguments. Link to comment
~Mr.Hassan Posted May 22, 2015 Author Share Posted May 22, 2015 The problem is resolved and repair code All who helped me thank them 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