Genius Posted June 1, 2012 Posted June 1, 2012 I made Arms Delar and when player hit my marker then he buy colt45 and his money is tanke but i didnt get money Server side: function give45 ( seller ) giveWeapon ( source, 22, 15, true) takePlayerMoney ( source, 100 ) if ( getElementModel( seller ) == 103 ) then givePlayerMoney ( seller, 200 ) end end addEvent("give45",true) addEventHandler("give45",getRootElement(),give45) Client side: addEventHandler ( "onClientGUIClick", getRootElement(), function give45 () if ( source == GUIEditor_Button[1] ) then triggerServerEvent ("give45",getLocalPlayer(),give45) end end addEventHandler ( "onClientGUIClick", getRootElement(),give45) MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Castillo Posted June 1, 2012 Posted June 1, 2012 That's because "seller" argument is nil, you're not triggering a player element. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Jaysds1 Posted June 1, 2012 Posted June 1, 2012 try this, Client: addEventHandler ( "onClientGUIClick",guiRoot,function() --if your attaching a function to an event, don't name it if ( source == GUIEditor_Button[1] ) then triggerServerEvent ("give45",localPlayer) --don't add the title again end end) -- forgot this Server: function give45 () --the player that's selling is the client/source of this, so there's no need for seller giveWeapon ( client, 22, 15, true) takePlayerMoney ( client, 100 ) if ( getElementModel( client ) == 103 ) then givePlayerMoney ( client, 200 ) end end addEvent("give45",true) addEventHandler("give45",root,give45) and please read the comments My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Castillo Posted June 2, 2012 Posted June 2, 2012 Jaysd, no offense but that's not right I think, if is an Arms Dealer, then there must be a Dealer and the player who buys the weapons. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Genius Posted June 2, 2012 Author Posted June 2, 2012 Bad argument @ "getElementModel" addEventHandler ( "onClientGUIClick",guiRoot,function(theSeller) local theSkin = getElementModel ( theSeller ) if ( theSkin == 103 ) and getElementType(theSeller) == "player" then if ( source == GUIEditor_Button[1] ) then triggerServerEvent ("give45",localPlayer) end end end) MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
top sniper Posted June 2, 2012 Posted June 2, 2012 addEventHandler ( "onClientGUIClick",guiRoot,function(theSeller) if getElementType(theSeller) == "player" then local theSkin = getElementModel ( theSeller ) if ( theSkin == 103 ) and ( source == GUIEditor_Button[1] ) then triggerServerEvent ("give45",localPlayer) end end end) ================================================================== ~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~ ==================================================================
Guest Guest4401 Posted June 2, 2012 Posted June 2, 2012 addEventHandler("onClientGUIClick",root, function() if source == GUIEditor_Button[1] then if getElementModel(localPlayer) == 103 then triggerServerEvent("give45",localPlayer) end end end )
Genius Posted June 2, 2012 Author Posted June 2, 2012 Bad argument @ "getElementModel" Whats the problem? function give45 (firstPlayer, seller) if (getElementModel(seller)==103) then givePlayerMoney (seller, 400 ) giveWeapon ( firstPlayer, 22, 15, true) takePlayerMoney ( firstPlayer, 100 ) end end addEvent("give45",true) addEventHandler("give45",root,give45) MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Al3grab Posted June 2, 2012 Posted June 2, 2012 is the dealer player or ped ? , if he is a ped you can't give him money ! ING : [xXx]~Al3grab
Wei Posted June 2, 2012 Posted June 2, 2012 Its player Diet with russian vodka, lose 3 days in one week !
Genius Posted June 2, 2012 Author Posted June 2, 2012 Dealer is player MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Al3grab Posted June 2, 2012 Posted June 2, 2012 use that and you have to define the seller in 'theSeller' variable. addEventHandler ( "onClientGUIClick", getRootElement(), function () local theSeller = theseller -- define the seller here if ( source == GUIEditor_Button[1] and theSeller) then triggerServerEvent ("give45",getLocalPlayer(),theSeller) end end ) function give45 (theSeller) if theSeller then takePlayerMoney(source,100) givePlayerMoney(theSeller,400) giveWeapon(source,22,15,true) end end addEvent("give45",true) addEventHandler("give45",root,give45) ING : [xXx]~Al3grab
Genius Posted June 2, 2012 Author Posted June 2, 2012 use that and you have to define the seller in 'theSeller' variable. addEventHandler ( "onClientGUIClick", getRootElement(), function () local theSeller = theseller -- define the seller here if ( source == GUIEditor_Button[1] and theSeller) then triggerServerEvent ("give45",getLocalPlayer(),theSeller) end end ) function give45 (theSeller) if theSeller then takePlayerMoney(source,100) givePlayerMoney(theSeller,400) giveWeapon(source,22,15,true) end end addEvent("give45",true) addEventHandler("give45",root,give45) Doesnt work No debug errors MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Genius Posted June 2, 2012 Author Posted June 2, 2012 I can send it in PM MTA Scripter. If you want scripter PM me and i will accept every job for fair price.
Jaysds1 Posted June 2, 2012 Posted June 2, 2012 Don't forget to send me one My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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