FeatCode Posted March 14, 2015 Share Posted March 14, 2015 Hey i want to ask where do i place the onClientClicked event for ped if my script is like this local Johnson = createPed(71, 251.2587890625, 69.673828125, 1003.640625) setPedRotation(Johnson,92.558471679688) setElementDimension(Johnson, 1) setElementInterior(Johnson, 6) setElementData( Johnson, "talk", 1 ) setElementData( Johnson, "name", "Officer Johnson" ) setElementFrozen( Johnson, true) local localPlayer = getLocalPlayer() function showLicenseWindow( ) triggerServerEvent("onLicenseServer", getLocalPlayer()) local vehiclelicense = getElementData(getLocalPlayer(), "license.car") local gunlicense = getElementData(getLocalPlayer(), "license.gun") local width, height = 300, 400 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wLicense= guiCreateWindow(x, y, width, height, "Los Santos Licensing Department", false) licenseList = guiCreateGridList(0.05, 0.05, 0.9, 0.8, true, wLicense) local column = guiGridListAddColumn(licenseList, "License", 0.7) local column2 = guiGridListAddColumn(licenseList, "Cost", 0.2) if (vehiclelicense~=1) then local row = guiGridListAddRow(licenseList) guiGridListSetItemText(licenseList, row, column, "Car License", false, false) guiGridListSetItemText(licenseList, row, column2, "450", true, false) end if (gunlicense~=1) then local row2 = guiGridListAddRow(licenseList) guiGridListSetItemText(licenseList, row2, column, "Weapon License", false, false) guiGridListSetItemText(licenseList, row2, column2, "4500", true, false) end bAcceptLicense = guiCreateButton(0.05, 0.85, 0.45, 0.1, "Buy License", true, wLicense) bCancel = guiCreateButton(0.5, 0.85, 0.45, 0.1, "Cancel", true, wLicense) showCursor(true) addEventHandler("onClientGUIClick", bAcceptLicense, acceptLicense) addEventHandler("onClientGUIClick", bCancel, cancelLicense) end addEvent("onLicense", true) addEventHandler("onLicense", getRootElement(), showLicenseWindow) Link to comment
xXMADEXx Posted March 14, 2015 Share Posted March 14, 2015 At the end of the script will do just fine. Link to comment
FeatCode Posted March 16, 2015 Author Share Posted March 16, 2015 wLicense, licenseList, bAcceptLicense, bCancel = nil local Johnson = createPed(71, 251.2587890625, 69.673828125, 1003.640625) setPedRotation(Johnson,92.558471679688) setElementDimension(Johnson, 1) setElementInterior(Johnson, 6) setElementData( Johnson, "talk", 1 ) setElementData( Johnson, "name", "Officer Johnson" ) setElementFrozen( Johnson, true) local localPlayer = getLocalPlayer() function showLicenseWindow( ) triggerServerEvent("onLicenseServer", getLocalPlayer()) local vehiclelicense = getElementData(getLocalPlayer(), "license.car") local gunlicense = getElementData(getLocalPlayer(), "license.gun") local width, height = 300, 400 local scrWidth, scrHeight = guiGetScreenSize() local x = scrWidth/2 - (width/2) local y = scrHeight/2 - (height/2) wLicense= guiCreateWindow(x, y, width, height, "Los Santos Licensing Department", false) licenseList = guiCreateGridList(0.05, 0.05, 0.9, 0.8, true, wLicense) local column = guiGridListAddColumn(licenseList, "License", 0.7) local column2 = guiGridListAddColumn(licenseList, "Cost", 0.2) if (vehiclelicense~=1) then local row = guiGridListAddRow(licenseList) guiGridListSetItemText(licenseList, row, column, "Car License", false, false) guiGridListSetItemText(licenseList, row, column2, "450", true, false) end if (gunlicense~=1) then local row2 = guiGridListAddRow(licenseList) guiGridListSetItemText(licenseList, row2, column, "Weapon License", false, false) guiGridListSetItemText(licenseList, row2, column2, "4500", true, false) end bAcceptLicense = guiCreateButton(0.05, 0.85, 0.45, 0.1, "Buy License", true, wLicense) bCancel = guiCreateButton(0.5, 0.85, 0.45, 0.1, "Cancel", true, wLicense) showCursor(true) addEventHandler("onClientGUIClick", bAcceptLicense, acceptLicense) addEventHandler("onClientGUIClick", bCancel, cancelLicense) end addEvent("onLicense", true) addEventHandler("onLicense", getRootElement(), showLicenseWindow) addEventHandler("onClientClick", getRootElement(), showLicenseWindow) Like this? If yes, it's not working cause it's just spaming triggerServerEvent Link to comment
JR10 Posted March 17, 2015 Share Posted March 17, 2015 Did you add the event server side? 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