joaosilva099 Posted August 11, 2014 Posted August 11, 2014 Hi all i have my own script to spawn cars that has a gui when the player hits the marker. And i want to add some cars to the Gui but only for players in ACL group called "Vip" I know isObjectInACLGroup() but it dont works client-side... My script: Client-Side: jWin = guiCreateWindow(550,560,200,200,"Sistema de Veículos",false) guiSetVisible(jWin,false) function openGui() guiSetVisible(jWin,true) function spawnveh(button, press) if(press) then if(button == "1") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 468, x, y, z, localPlayer) end if(button == "2") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 457, x, y, z, localPlayer) end if(button == "3") then x, y, z = getElementPosition(localPlayer) triggerServerEvent("crVeh", getRootElement(), 412, x, y, z, localPlayer) end end end addEventHandler("onClientKey", getRootElement(), spawnveh) guiWindowSetSizable(jWin,false) tGrid = guiCreateGridList(0,20,190,170,false,jWin) guiGridListAddColumn(tGrid, "Tecla", 0.20) guiGridListAddColumn(tGrid, "Nome", 0.65) row1 = guiGridListAddRow(tGrid) row2 = guiGridListAddRow(tGrid) row3 = guiGridListAddRow(tGrid) guiGridListSetItemText(tGrid, row1, 1, tostring(row1+1), false, false) guiGridListSetItemText(tGrid, row1, 2, "Sanchez", false, false) guiGridListSetItemText(tGrid, row2, 1, tostring(row2+1), false, false) guiGridListSetItemText(tGrid, row2, 2, "Caddy", false, false) guiGridListSetItemText(tGrid, row3, 1, tostring(row3+1), false, false) guiGridListSetItemText(tGrid, row3, 2, "Voodoo", false, false) end addEvent("markerHitted", true) addEventHandler("markerHitted", getRootElement(), openGui) function hideGui() guiSetVisible(jWin,false) removeEventHandler("onClientKey", getRootElement(), spawnveh) end addEvent("markerLeaved", true) addEventHandler("markerLeaved", getRootElement(), hideGui) Server-side: pv = { } sp1 = createMarker(1920.96960, -1791.41931, 12.25451, "cylinder", 1.5, 0, 255, 0, 150) sp2 = createMarker(1372.22998, -1600.58765, 12.55247, "cylinder", 1.5, 0, 255, 0, 150) sp3 = createMarker(1149.63818, -1429.25403, 14.79688, "cylinder", 1.5, 0, 255, 0, 150) sp4 = createMarker(1204.98145, -1070.53796, 28.24623, "cylinder", 1.5, 0, 255, 0, 150) sp5 = createMarker(652.31482, -1767.81738, 12.55009, "cylinder", 1.5, 0, 255, 0, 150) sp6 = createMarker(2455.93091, -1787.65576, 12.54688, "cylinder", 1.5, 0, 255, 0, 150) sp7 = createMarker(2154.16821, -1167.59106, 22.82215, "cylinder", 1.5, 0, 255, 0, 150) sp8 = createMarker(-20.03092, -278.19138, 4.42969, "cylinder", 1.5, 0, 255, 0, 150) sp9 = createMarker(1736.50134, 1877.01477, 9.82031, "cylinder", 1.5, 0, 255, 0, 150) sp10 = createMarker(2377.19727, 2019.28247, 9.82031, "cylinder", 1.5, 0, 255, 0, 150) sp11 = createMarker(2898.70703, 2454.66870, 9.82031, "cylinder", 1.5, 0, 255, 0, 150) sp12 = createMarker(-1454.17456, 1870.05615, 31.63281, "cylinder", 1.5, 0, 255, 0, 150) sp13 = createMarker(-2251.42944, 2329.95679, 3.81250, "cylinder", 1.5, 0, 255, 0, 150) sp14 = createMarker(-2242.80200, 537.43109, 34.12649, "cylinder", 1.5, 0, 255, 0, 150) sp15 = createMarker(-1985.65979, 269.49936, 34.17936, "cylinder", 1.5, 0, 255, 0, 150) sp16 = createMarker(-1498.97607, 849.02643, 6.18750, "cylinder", 1.5, 0, 255, 0, 150) sp17 = createMarker(-2142.76392, -2447.32666, 29.63276, "cylinder", 1.5, 0, 255, 0, 150) createBlipAttachedTo(sp1, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp2, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp3, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp4, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp5, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp6, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp7, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp8, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp9, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp10, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp11, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp12, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp13, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp14, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp15, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp16, 38, 2, 0, 255, 0, 255, 0, 500) createBlipAttachedTo(sp17, 38, 2, 0, 255, 0, 255, 0, 500) function createTheVehicle(id, posx, posy, posz, player) if(isElement(pv[player])) then destroyElement(pv[player]) end pv[player] = createVehicle(id, posx, posy, posz + 5) warpPedIntoVehicle(player, pv[player]) if(getTeamName(getPlayerTeam(player)) == "Staff") then addVehicleUpgrade(pv[player], 1010) end end addEvent("crVeh", true) addEventHandler("crVeh", getRootElement(), createTheVehicle) -- addEventHandler("onMarkerHit", sp1, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp1, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp2, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp2, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp3, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp3, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp4, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp4, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp5, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp5, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp6, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp6, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp7, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp7, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp8, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp8, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp9, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp9, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp10, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp10, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- addEventHandler("onMarkerHit", sp11, function(hitElement) if(getElementType(hitElement) == "player") then triggerClientEvent(hitElement, "markerHitted", getRootElement()) end end ) addEventHandler("onMarkerLeave", sp11, function(leftElement) if(getElementType(leftElement) == "player") then triggerClientEvent(leftElement, "markerLeaved", getRootElement()) end end ) -- http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 11, 2014 Posted August 11, 2014 Trigger to server-side to get his group. Then trigger back to client and continue your script. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 11, 2014 Author Posted August 11, 2014 i thinked that too but i can't get that from my head... can make me some ''light'' to my head? http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 11, 2014 Posted August 11, 2014 Client-side: triggerServerEvent("Checkmyawesomegroupifiminit", getLocalPlayer()) Server-side: --Code to check or she/he is in that group triggerClientEvent(source, "Backtoclientnamestufflol", source, --[[i just used my first source here : D]], variable-or-is-in-the-group) ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 11, 2014 Author Posted August 11, 2014 thanks i will try http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
joaosilva099 Posted August 11, 2014 Author Posted August 11, 2014 Tried this dont worked... Client function setvvar(root, yn) if(yn == "yes") then vip = "yes" else if(yn == "no") then vip = "no" end end triggerServerEvent("checkVip", getLocalPlayer()) addEvent("pisvip", true) addEventHandler("pisvip", getRootElement(), setvvar) Server function checkVip(player) if(isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Vip"))) then triggerClientEvent(player, "pisvip", getRootElement(), "yes") else triggerClientEvent(player, "pisvip", getRootElement(), "no") end end addEvent("checkVip", true) addEventHandler("checkVip", getRootElement(), checkVip) Any idea? http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 11, 2014 Posted August 11, 2014 Use 'source' instead of 'player'. And remove 'player' out of the function. ONLY if you are using: triggerServerEvent("fjkjkfjksdf", getLocalPlayer()) and not: triggerServerEvent("dfsdfj", getRootElement(), getLocalPlayer()) Also: function setvvar(root, yn) Remove 'root'. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 11, 2014 Author Posted August 11, 2014 nothing happening, now neither shows the GUI http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 11, 2014 Posted August 11, 2014 Client-side: function setvvar(yn) vip = yn end end triggerServerEvent("checkVip", getLocalPlayer()) addEvent("pisvip", true) addEventHandler("pisvip", getRootElement(), setvvar) Server-side: function checkVip() if(isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip"))) then triggerClientEvent(source, "pisvip", getRootElement(), "yes") else triggerClientEvent(source, "pisvip", getRootElement(), "no") end end addEvent("checkVip", true) addEventHandler("checkVip", getRootElement(), checkVip) Edited again. :') ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 11, 2014 Author Posted August 11, 2014 i will try later i answer Thanks!!! http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
xXMADEXx Posted August 11, 2014 Posted August 11, 2014 It would be better to store if the player is VIP with setElementData and getElementData The Ultimate Lua Tutorial! | MTA PHP SDK
joaosilva099 Posted August 12, 2014 Author Posted August 12, 2014 Thanks Et-win i made it but before i had to remove one ''end'' on client side thanks http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 12, 2014 Posted August 12, 2014 You're welcome. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 12, 2014 Author Posted August 12, 2014 Err... I'm having other problem... I can check if player is vip yea so far so good... but when the player disconnects (logs out) and relogs in and they hit the marker dont shows the ''VIP'' vehicles only the normal player vehicles and i have to restart resource and they are shown in the gui again... and when reconnects all happens again http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Max+ Posted August 12, 2014 Posted August 12, 2014 Err...I'm having other problem... I can check if player is vip yea so far so good... but when the player disconnects (logs out) and relogs in and they hit the marker dont shows the ''VIP'' vehicles only the normal player vehicles and i have to restart resource and they are shown in the gui again... and when reconnects all happens again It would be better to store if the player is VIP with setElementData and getElementData setElementData getElementData 'onPlayerQuit' 'onPlayerLogin' - New , Kill System - New, GameMode Intro - Leve / Exp System - New nametag showing style - New , Hud For Players - Skin Selection from SA-MP - Money System / Buy Weapons - Drop Weapons - New, Flood System - New , Group Assign - Gun license For Weapons - Random Rule System For Money
Et-win Posted August 12, 2014 Posted August 12, 2014 --Event: onPlayerLogin ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 12, 2014 Author Posted August 12, 2014 client side dont has onplayerlogin... and i can't do nothing with get/set elementdata i tried it before http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 12, 2014 Posted August 12, 2014 But you can use that, it also returns the player who logged in. Just add if the eventName was onPlayerLogin source = thePlayer ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 12, 2014 Author Posted August 12, 2014 how? http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
Et-win Posted August 12, 2014 Posted August 12, 2014 function checkVip() if(isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Vip"))) then triggerClientEvent(source, "pisvip", getRootElement(), "yes") else triggerClientEvent(source, "pisvip", getRootElement(), "no") end end addEvent("checkVip", true) addEventHandler("checkVip", getRootElement(), checkVip) add event onPlayerLogin That's all. ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
joaosilva099 Posted August 12, 2014 Author Posted August 12, 2014 thanks worked http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
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