- 
                Posts732
- 
                Joined
- 
                Last visited
- 
                Days Won1
Everything posted by Bean666
- 
	i did smth like this. function onQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local timerget = getTimerDetails( timer[source] ) setAccountData ( playeraccount, "timercd", timerget ) end end addEventHandler ( "onPlayerQuit", root, onQuit ) function onLogin () if ( playeraccount ) then local Timer = getAccountData ( playeraccount, "timercd" ) if ( Timer ) then timer[source] = setTimer(function() timer[source] = nil outputChatBox("You can now use the advert again", source) end, Timer, 1) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), onLogin)
- 
	i tried mine / walid's code and it seems working.
- 
	EDIT: ah , doesn't work, any tips/help? function onQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local timerget = getTimerDetails( timer[source] ) setAccountData ( playeraccount, "timercd", timerget ) end end addEventHandler ( "onPlayerQuit", root, onQuit )
- 
	you had a typo should be oFaction not iFaction function rankMySelf (thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) local oFaction = getElementData(thePlayer, "Faction") if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then if tonumber(oFaction) == nil then setElementData(thePlayer, "Faction", 1) setElementData(thePlayer, "Rank", 6) outputChatBox ("working", thePlayer) end end end addCommandHandler( "rankme", rankMySelf)
- 
	how could you save a timer onplayerquit and set it back right onplayerlogin? im using a timer like this, this is my first time trying to save a timer. so i'm kinda curious how? any tips/help, appreciated. local timer = {} function ex(source) if timer[source] and isTimer(timer[source]) then return end timer[source] = setTimer(function() timer[source] = nil outputChatBox("blablablabla", source) end, 3600*500, 1) end addCommandHandler ( "ex", ex )
- 
	local rmoney = {1210, 6235, 3629, 2958, 591} function kill (killer, weapon, bodypart, loss) if (killer) then givePlayerMoney ( killer, rmoney[ math.random(#rmoney) ] ) end end addEventHandler ( "onPlayerWasted", getRootElement(), kill)
- 
	how can i make onElementDataChange work on a certain data only? ex: it will only trigger if he changed his "Job" data. ex: he changed his Job "Fisherman" to "Mechanic". so that it will not work on other data changes. only on the "Job" data.
- 
	remove all of that and add this, this timer already starts when resource starts, i suggest using elementdatas tho...: try this: function minutes() local thePlayer = getPlayerAccount ( source ) local Minutes = getAccountData(thePlayer,"Minutes") if Minutes then setAccountData(thePlayer,"Minutes",tonumber(getAccountData(thePlayer,"Minutes"))+1) end end setTimer ( minutes, 60000, 0 ) element data: i might have missing / non-needed ends here, you edit it if wrong. function minutes() for i, thePlayer in ipairs(getElementsByType("player")) do local Minutes = getElementData(thePlayer,"Minutes") if Minutes then setElementData(thePlayer,"Minutes",tonumber(getElementData(thePlayer,"Minutes"))+1) end end setTimer ( minutes, 60000, 0 )
- 
	ye im also thinking that he is using setObjectScale probably.
- 
	outputChatBox ("You are not admin! Go away from admin base") you are also outputting the text to all players, by not putting any element use outputChatBox("You are not admin! Go away from admin base", player)
- 
	dxDrawTextonElement is not an MTA-Defined function , you need that function first , the one i gave you. and dxDrawTextOnElement doesn't work on Objects unless you edit the settings, the ignoredElement , etc ,etc
- 
	make sure you have this function and enable object see through in this function as it doesn't work with objects , i use a PED then make it's alpha 0... well you can enable objects by changing some settings: function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,checkBuildings,checkVehicles,checkPeds,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getElementPosition(localPlayer) local distance = distance or 20 local height = height or 1 local checkBuildings = checkBuildings or true local checkVehicles = checkVehicles or false local checkPeds = checkPeds or false local checkObjects = checkObjects or true local checkDummies = checkDummies or true local seeThroughStuff = seeThroughStuff or false local ignoreSomeObjectsForCamera = ignoreSomeObjectsForCamera or false local ignoredElement = ignoredElement or nil if (isLineOfSightClear(x, y, z, x2, y2, z2, checkBuildings, checkVehicles, checkPeds , checkObjects,checkDummies,seeThroughStuff,ignoreSomeObjectsForCamera,ignoredElement)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end
- 
	btw i'm creating a marker and i have it on "corona", but it's creating a huge cylinder, even i change the size to 0 i used setMarkerSize , the size got small but the marker is so high , it's exceeding over the top. nvm fixed.
- 
	btw is it possible to trigger setElementVisibleTo from s-side to c-side?
- 
	how could i destroy the blip that was attached to the destroyed marker and attach a new blip to the new created marker again? function createMarkers ( ) loc = math.random ( #markers ) marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) blip = createBlipAttachedTo(marker, 41) end function MarkerHit ( hitPlayer, matchingDimension ) if (hitPlayer == localPlayer) then createMarkers() destroyElement(source) end end addEventHandler ( "onClientMarkerHit", resourceRoot, MarkerHit )
- 
	is some thing like this possible? i tried once and seems not to work or maybe i just did smth wrong , i want to attach blips on things that has the Element ID "marker" any tips/help? local FishingSpot = createMarker(494.214, -1925.360, -0.550, 'cylinder', 5.0, 0, 0, 255, 150) setElementID(FishingSpot, "marker") local FishingSpot2 = createMarker(469, -1941.166015625, -0, 'cylinder', 5.0, 0, 0, 255, 150) setElementID(FishingSpot2, "marker") local id = getElementByID("marker") local blips = createBlipAttachedTo(id, 41)
- 
	I'm getting a getelementtype nil here idk why function acceptjob(player) if (getElementType(player) == "player") then setElementData(player, "Job", "Fishermen") setElementData(player, "Fishermen", true) outputChatBox("You are now a fisherman!", player, 255, 255, 0) setPlayerTeam(player, getTeamFromName("Services")) end end addEvent("acceptjob", true) addEventHandler("acceptjob", getRootElement(), acceptjob) client that's triggering the event addEventHandler("onClientGUIClick",resourceRoot,function() if (source == accept) then guiSetVisible(window,false) showCursor(false) triggerServerEvent("acceptjob", localPlayer) elseif ( source == cancel) then guiSetVisible(window,false) showCursor(false) end end )
- 
	I'm getting a getelementtype nil here idk why function acceptjob(player) if (getElementType(player) == "player") then setElementData(player, "Job", "Fishermen") setElementData(player, "Fishermen", true) outputChatBox("You are now a fisherman!", player, 255, 255, 0) setPlayerTeam(player, getTeamFromName("Services")) end end addEvent("acceptjob", true) addEventHandler("acceptjob", getRootElement(), acceptjob) client that's triggering the event addEventHandler("onClientGUIClick",resourceRoot,function() if (source == accept) then guiSetVisible(window,false) showCursor(false) triggerServerEvent("acceptjob", localPlayer) elseif ( source == cancel) then guiSetVisible(window,false) showCursor(false) end end )
- 
	but he didn't say when player dies. so basically when onPlayerDamage after "shot in the head", he can also do a timer on the killPed or if he means if the Player died then the body does animation then use onPlayerWasted, agreed on that
- 
	yes i know , i meant here are the things you'll need, sorry bout that.
- 
	try it by yourself, i'll give you the functions you need getPlayerWantedLevel -- check player wanted level setElementPosition -- for the jail onPlayerWasted -- you need this function if the wanted player dies(kill arrest)

.gif.37bdc3c91074560197473b5b12ecdc15.gif) 
            
        