youpit Posted February 20, 2012 Posted February 20, 2012 Hi all i tried to make a script but its dont work what wrong ? Server-side addEventHandler ("onClientVehicleRespawn",nil,muh, function (fxAddGlass) local account = getPlayerAccount(fxAddGlass) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then triggerClientEvent (hitPlayer,"muh",fxAddGlass) else outputChatBox ("Sorry you are not prenuim !",fxAddGlass) end end) Client-side function muh () for k, v in ipairs(getElementsByType("vehicle")) do local x, y, z = getElementPosition(v) local c = math.random(0, 126) fxAddGlass(x, y, z, math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), 0.08, 1) end end addEvent ( "muh", true ) addEventHandler("muh",root,muh)
Kenix Posted February 20, 2012 Posted February 20, 2012 Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction
HunT Posted February 20, 2012 Posted February 20, 2012 What wrong ???????? All the event "onClientVehicleRespawn" is client side. Anyway Try it : ServerSide function AdminGlass (player) local theAccount=getPlayerAccount(player) if theAccount then local accountName = getAccountName(theAccount) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then triggerClientEvent(player,"addGlass",getRootElement()) end end end function checkAdmin() setTimer(AdminGlass,100,1,source) end addEventHandler("onPlayerSpawn",getRootElement(),checkAdmin) ClientSide addEvent ( "addGlass", true ) function createGlass() local vehicle = getPedOccupiedVehicle (getLocalPlayer()) x,y,z=getElementPosition(vehicle) if vehicle then fxAddGlass(x,y,z+1,math.random(10, 255),math.random(10, 255),math.random(10, 255),255,0.1,1) end end setTimer ( createGlass, 50, 0 ) addEventHandler("addGlass",getRootElement(),createGlass)
Edikosh998 Posted February 20, 2012 Posted February 20, 2012 Althought Hunterix helped you with your script, I suggest you reading MTAs wiki. Like getPlayerAccount( ) --need a player value Also if you put for k, v in ipairs(getElementsByType("vehicle")) do --There it will return a table with all the vehicles at the server So try watching function's arguments and what it return. Sorry for my bad english.
youpit Posted February 20, 2012 Author Posted February 20, 2012 thx a lot, but I can't see the fx on others admin, it's in local
diegofkda Posted February 20, 2012 Posted February 20, 2012 That script would make the server crash, if not, then the server would have an unstable bandwidth and if not that then it would have unwanted effects because triggerClientEvent consumes server bandwidth resources. The way to make it is using setElementData, getElementData and onClientRender event.
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