xuaNN Posted January 6, 2019 Share Posted January 6, 2019 Hi guys, im going to make a guest peds script for my roleplay server. But i have some issues. function gorevGUI(thePlayer) local oyuncuLonca = getPlayerTeam(thePlayer) local loncaTip = getElementData(oyuncuLonca, "type") local loncaLevel = getElementData(oyuncuLonca, "birlik_level") if (loncaTip) and (loncaTip == 0) then if loncaLevel < 2 then triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Karşındaki diyor ki: " .. levelEksikMsg[math.random(#levelEksikMsg)], 255, 255, 255, 10, {}, true) outputChatBox("[!] #FFFFFFBu işi yapabilmek için loncanızın en az 2.seviye olması gerekmektedir.", 255, 0, 0, true) return else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Karşındaki fısıldar: Hey, elimde bir görev var. Ne dersin, ha?", 255, 255, 255, 3, {}, true) gorevKabulGUI(thePlayer) return end else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Karşındaki diyor ki: Seninle bir işim yok. Derhal toz ol buradan.", 255, 255, 255, 10, {}, true) return end end addEvent("gorevGUI", true) addEventHandler("gorevGUI", getRootElement(), gorevGUI) WARNINGS; Bad argument @ 'getPlayerTeam' [Expected Player at argument 1, got nil] Bad argument @ 'getElementData' [Expected Element at argument 1, got boolean] Bad argument @ 'getElementData' [Expected Element at argument 1, got boolean] how can i solve this problem? Link to comment
Dimos7 Posted January 6, 2019 Share Posted January 6, 2019 Change thePlayer to localPlayer Link to comment
Sorata_Kanda Posted January 6, 2019 Share Posted January 6, 2019 Just now, Dimos7 said: Change thePlayer to localPlayer Or: Set something like this in case you don't like localPlayer as a variable name: local me = getLocalPlayer() -- This should work as well local me = localPlayer Link to comment
xuaNN Posted January 7, 2019 Author Share Posted January 7, 2019 Not worked, same problem. local me = localPlayer local gPed1 = createPed( 32, 1913.11328125, -1806.2041015625, 13.546875 ) setPedRotation( gPed1, 270 ) setElementDimension( gPed1, 0) setElementInterior( gPed1 , 0 ) setElementData( gPed1, "talk", 1, false ) setElementData( gPed1, "name", "Çavuş Alcibiade Sinnerman", false ) setElementFrozen(gPed1, true) local gPed2 = createPed( 1, 1913.4462890625, -1808.294921875, 13.546875 ) setPedRotation( gPed2, 270 ) setElementDimension( gPed2, 0) setElementInterior( gPed2 , 0 ) setElementData( gPed2, "talk", 1, false ) setElementData( gPed2, "name", "Çiftçi Brian Elcabor", false ) setElementFrozen(gPed2, true) local gPed3 = createPed( 2, 1913.7099609375, -1810.29296875, 13.546875 ) setPedRotation( gPed3, 270 ) setElementDimension( gPed3, 0) setElementInterior( gPed3 , 0 ) setElementData( gPed3, "talk", 1, false ) setElementData( gPed3, "name", "Hancı Armando Elcabor", false ) setElementFrozen(gPed3, true) local gPed4 = createPed( 2, 1914.083984375, -1812.4130859375, 13.546875 ) setPedRotation( gPed4, 270 ) setElementDimension( gPed4, 0) setElementInterior( gPed4 , 0 ) setElementData( gPed4, "talk", 1, false ) setElementData( gPed4, "name", "Tüccar Leonardo Gustav", false ) setElementFrozen(gPed4, true) local levelEksikMsg = { "Sana verebileceğim bir iş yok.", "İşler biraz kötü, sonra gelirsen belki." } local kabulEtMsg = { "Bana uyar.", "Güzel teklif.", "Ne zaman başlıyorum?", } local kabulEtmeMsg = { "İşim olmaz.", "Daha önemli işlerim var.", "Meşgulüm.", } function gorevGUI(me) alonca = getPlayerTeam(me) loncaseviye = getElementData(alonca,"birlikLevel") loncatipi = getElementData(alonca,"type") if (loncatipi) and (loncatipi == 0) or (loncatipi == 1) then if loncaseviye < 3 then triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount diyor ki: " .. levelEksikMsg[math.random(#levelEksikMsg)], 255, 255, 255, 10, {}, true) outputChatBox("[!] #FFFFFFBu işi yapabilmek için loncanızın en az 3.seviye olması gerekmektedir.", 255, 0, 0, true) return else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount fısıldar: Hey, elimde bir iş var. Ne dersin, ha?", 255, 255, 255, 3, {}, true) gorevKabulGUI(me) return end else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount diyor ki: Seninle bir işim yok. Derhal toz ol buradan.", 255, 255, 255, 10, {}, true) return end end addEvent("gorevGUI", true) addEventHandler("gorevGUI", getRootElement(), gorevGUI) There is full code i wrote. i am getting problem with element data lines. And the getPlayerTeam line Link to comment
DNL291 Posted January 8, 2019 Share Posted January 8, 2019 5 hours ago, xuaNN said: There is full code i wrote. i am getting problem with element data lines. I doubt that you who made the code; You were not able to fix by yourself a simple problem. BTW, Try this: function gorevGUI() local alonca = getPlayerTeam(localPlayer) local loncaseviye, loncatipi = false,false if alonca then loncaseviye = getElementData(alonca,"birlikLevel") loncatipi = getElementData(alonca,"type") end if (loncatipi) and (loncatipi == 0) or (loncatipi == 1) then if loncaseviye and loncaseviye < 3 then triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount diyor ki: " .. levelEksikMsg[math.random(#levelEksikMsg)], 255, 255, 255, 10, {}, true) outputChatBox("[!] #FFFFFFBu işi yapabilmek için loncanızın en az 3.seviye olması gerekmektedir.", 255, 0, 0, true) return else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount fısıldar: Hey, elimde bir iş var. Ne dersin, ha?", 255, 255, 255, 3, {}, true) gorevKabulGUI(me) return end else triggerServerEvent("sendLocalText", getLocalPlayer(), getLocalPlayer(), "[English] Joffrey Yount diyor ki: Seninle bir işim yok. Derhal toz ol buradan.", 255, 255, 255, 10, {}, true) return end end addEvent("gorevGUI", true) addEventHandler("gorevGUI", getRootElement(), gorevGUI) 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