Unique23 Posted February 2, 2014 Posted February 2, 2014 Good Night everyone! I decided to make a Fighting Styles GUI but I have a problem with takePlayerMoney. Firstly,I used this to take money from the players. function learnkungfuu() local status = setPlayerFightingStyle ( source, 6 ) takePlayerMoney(source,350) end addEvent("leankungfu",true) addEventHandler("leankungfu", root, learnkungfuu) If you don't have enough money , your money becomes at -$. I didn't want that and I used this, Client Side: GUIEditor = { button = {}, window = {} } GUIEditor.window[1] = guiCreateWindow(542, 157, 292, 438, "Figthing Skills", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(54, 111, 183, 49, "Get Boxing Skills for $250", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") GUIEditor.button[2] = guiCreateButton(54, 213, 181, 47, "Get Kung-Fu Skills for $350", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000") GUIEditor.button[4] = guiCreateButton(54, 304, 183, 48, "Get Wrestling Skills for $450", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFF0000") GUIEditor.button[5] = guiCreateButton(38, 395, 219, 33, "DONE", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[5], "default-bold-small") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFF7EE07") guiWindowSetMovable(GUIEditor.window[1],false) guiWindowSetSizable(GUIEditor.window[1],false) guiSetVisible(GUIEditor.window[1], true) showCursor(true) function buttonpressed() button=source if source==GUIEditor.button[1] then triggerServerEvent("learnbox", getRootElement()) elseif source==GUIEditor.button[2] then triggerServerEvent("leankungfu",getRootElement()) elseif source==GUIEditor.button[4] then triggerServerEvent("learnwrestling",getRootElement()) elseif source==GUIEditor.button[5] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end addEventHandler("onClientGUIClick",getRootElement(),buttonpressed) Server Side, not done yet , I just made it for first command function learnboxx() local status = setPlayerFightingStyle ( source, 5 ) local money = getPlayerMoney(source) - if (money >=250) then takePlayerMoney(source,250) else outputChatBox ("Sorry,You don't have enough money to buy this skill.!", 255, 0, 0, true) end end addEvent("learnbox",true) addEventHandler("learnbox", root, learnboxx) function learnkungfuu() local status = setPlayerFightingStyle ( source, 6 ) takePlayerMoney(source,350) end addEvent("leankungfu",true) addEventHandler("leankungfu", root, learnkungfuu) function learnwrestlingg() local status = setPlayerFightingStyle ( source,7 ) takePlayerMoney(source,450) end addEvent("learnwrestling",true) addEventHandler("learnwrestling",root,learnwrestlingg)
Castillo Posted February 2, 2014 Posted February 2, 2014 What is the problem? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Unique23 Posted February 2, 2014 Author Posted February 2, 2014 Line 5:Bad 'player' pointer @getplayermoney Line 6:attempt to compare number with boolean
Castillo Posted February 2, 2014 Posted February 2, 2014 triggerServerEvent("learnbox", getRootElement()) Change that getRootElement ( ) to localPlayer. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted February 2, 2014 Posted February 2, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Unique23 Posted February 3, 2014 Author Posted February 3, 2014 Uhm, We have a weird problem. Client Side GUIEditor = { button = {}, window = {} } GUIEditor.window[1] = guiCreateWindow(542, 157, 292, 438, "Figthing Skills", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 0.75) GUIEditor.button[1] = guiCreateButton(54, 111, 183, 49, "Get Boxing Skills for $250", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "default-bold-small") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") GUIEditor.button[2] = guiCreateButton(54, 213, 181, 47, "Get Kung-Fu Skills for $350", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "default-bold-small") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000") GUIEditor.button[4] = guiCreateButton(54, 304, 183, 48, "Get Wrestling Skills for $450", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[4], "default-bold-small") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFFF0000") GUIEditor.button[5] = guiCreateButton(38, 395, 219, 33, "DONE", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[5], "default-bold-small") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFF7EE07") guiWindowSetMovable(GUIEditor.window[1],false) guiWindowSetSizable(GUIEditor.window[1],false) guiSetVisible(GUIEditor.window[1], false) showCursor(false) function buttonpressed() button=source if source==GUIEditor.button[1] then triggerServerEvent("learnbox",localPlayer) elseif source==GUIEditor.button[2] then triggerServerEvent("leankungfu",localPlayer) elseif source==GUIEditor.button[4] then triggerServerEvent("learnwrestling",localPlayer) elseif source==GUIEditor.button[5] then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end addEventHandler("onClientGUIClick",getRootElement(),buttonpressed) gostermarker=createMarker(759.17218, -60.21177, 999.8,"cylinder",1,0,255,255) setElementDimension(gostermarker,200) setElementInterior(gostermarker,7) function MarkerHit( thePlayer ) if getElementType( thePlayer ) == "player" then guiSetVisible (GUIEditor.window[1], true ) showCursor(true) end end addEventHandler( "onClientMarkerHit", gostermarker , MarkerHit ) Server Side --Interior Warper giris=createMarker(2229.6999511719,-1721.4000244141,15,"arrow",1,0,0,255) giriscol=createColSphere(2229.79883, -1721.41113, 13.56275,1.2) function gotogym (player) setElementInterior(player,7) setElementDimension(player,200) fadeCamera(player,false, 1, 0,0,0) setTimer(setElementPosition, 1000, 1, player,774,-75,1000) setTimer(fadeCamera, 2000, 1, player, true) end addEventHandler("onColShapeHit",giriscol,gotogym) ---Geri warper cikis=createMarker(773.8, -78.84709, 1001.85,"arrow",1,0,0,255) setElementDimension(cikis,200) setElementInterior(cikis,7) cikiscol=createColSphere(773.78088, -78.57690, 1000.6624,1.2) function goback (player) setElementInterior(player,0) setElementDimension(player,0) fadeCamera(player,false, 1, 0,0,0) setTimer(setElementPosition, 1000, 1, player,2227.53784 ,-1722.58276, 13.5549) setTimer(fadeCamera, 2000, 1, player, true) end addEventHandler("onColShapeHit",cikiscol,goback) function learnboxx() local money = getPlayerMoney(source) if (money >=250) then takePlayerMoney(source,250) local status = setPlayerFightingStyle ( source, 5 ) outputChatBox ("You have succesfully bought Box skills",source,255,255,0) else outputChatBox ("Sorry,You don't have enough money to buy this skill.!",source,255,255,0) end end addEvent("learnbox",true) addEventHandler("learnbox", root, learnboxx) function learnkungfuu() local money = getPlayerMoney(source) if (money >=350) then takePlayerMoney(source,350) local status = setPlayerFightingStyle ( source, 6 ) outputChatBox ("You have succesfully bought Kung-Fu skills",source,255,255,0) else outputChatBox ("Sorry,You don't have enough money to buy this skill.!",source,255,255,0) end end addEvent("leankungfu",true) addEventHandler("leankungfu", root, learnkungfuu) function learnwrestlingg() local money = getPlayerMoney(source) if (money >=450) then takePlayerMoney(source,450) local status = setPlayerFightingStyle ( source, 7 ) outputChatBox ("You have succesfully bought Wrestling skills",source,255,255,0) else outputChatBox ("Sorry,You don't have enough money to buy this skill.!",source,255,255,0) end end addEvent("learnwrestling",true) addEventHandler("learnwrestling",root,learnwrestlingg) The problem is, When I hit the marker , GUI pops up for everyone.
Castillo Posted February 3, 2014 Posted February 3, 2014 function MarkerHit( thePlayer ) if getElementType( thePlayer ) == "player" then Change: if getElementType( thePlayer ) == "player" then to: if ( localPlayer == thePlayer ) then San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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