-
Posts
1,058 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Saml1er
-
Replace this in Line 22 showPlayerHudComponent( "radar", true )
-
setElementData ( thePlayer, "afk.godmode", nil ) Line 35 and takeAllWeapons is server side function. Just tell me why do want client side script since its possible to script it in server side. The code I posted was server side, you can use it. addCommandHandler( "afk", function ( thePlayer ) setElementPosition( thePlayer, 1904.8403320313, 717.12438964844, 49.214366912842 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now in Afk zone", thePlayer, 0, 255, 0 ) if takeAllWeapons ( thePlayer ) then setElementData ( thePlayer, "GodO.Health", "yep!" ) end end ) addEventHandler ("onPlayerDamage", getRootElement(), function () if getElementData ( source, "GodO.Health" ) == "yep!" then cancelEvent() end end ) addCommandHandler( "back", function ( thePlayer ) if isElementFrozen (thePlayer ) then setElementPosition( thePlayer, -2026.7408447266, 156.45680236816, 29.0390625 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now Out Afk zone", thePlayer, 255, 0, 0 setElementData ( thePlayer, "GodO.Health", nil ) setElementFrozen (thePlayer, false ) end end )
-
Does it output anything like numbers? That code looks pretty fine to me. >.> ( talking about citizen code ) oh well I thought you meant clicking the marker( now talking about mine). EDIT: you're using the old one, use this one as citize just told you now. function guiwindow () outputChatBox("4 - guiwindow") if isPedInVehicle( localPlayer ) == true then return end outputChatBox("5") -- if (getElementType ( source ) == "player") then --not needed anymore outputChatBox("6") guiSetVisible(GUIEditor.window[1], true) showCursor ( true ) -- end outputChatBox("7 - end guiWindow") end addEvent( "test", true ) addEventHandler( "test", root, guiwindow )
-
I got the problem. function pedclick ( theButton, theState, thePlayer ) if theButton == "left" and theState == "up" then if getElementType ( source ) == "marker" then triggerClientEvent ( thePlayer, "test", getRootElement()) outputChatBox("Test") end end end addEventHandler( "onElementClicked", root, pedclick )
-
replace line 4 with triggerClientEvent ( thePlayer, "test" ) if this doesn't work then try this. triggerClientEvent ( thePlayer, "test", getRootElement() )
-
This subforum is meant to help others so just ask your question and we'll help you.
-
function pedclick ( theButton, theState, thePlayer ) local clickedElement = source if clickedElement == policeped and theButton == "left" and theState == "up" then triggerClientEvent ( thePlayer, "test", thePlayer ) outputChatBox("Test") end end addEventHandler( "onElementClicked", root, pedclick ) function guiwindow ( ) if isPedInVehicle (getLocalPlayer ()) then guiSetVisible(GUIEditor.window[1], true) showCursor ( true ) end end addEvent( "test", true ) addEventHandler( "test", root, guiwindow )
-
You guys gave speeches like a president seriously, there's no support from any developer because they'll do what pleases them nor we can do anything it..... It might sound stupid but I keep the original script in my inbox ( email ) because if I ever lost the original one then I'll be able to recover it back.
-
addCommandHandler( "back", function ( thePlayer ) setElementPosition( thePlayer, -2026.7408447266, 156.45680236816, 29.0390625 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now Out Afk zone", thePlayer, 255, 0, 0 ) setElementData ( thePlayer, "GodO.Health", nil ) -- this will remove god mode end )
-
in the group can see the names of members on a map?
Saml1er replied to vn007322815's topic in Scripting
Don't ask to ask a question, just ask. This subforum actually is meant to help people. -
Oh thank you, I searched for it but Idk I couldn't find it. Here again: addCommandHandler( "afk", function ( thePlayer ) setElementPosition( thePlayer, 1904.8403320313, 717.12438964844, 49.214366912842 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now in Afk zone", thePlayer, 0, 255, 0 ) if takeAllWeapons ( thePlayer ) then setElementData ( thePlayer, "GodO.Health", "yep!" ) end end ) addEventHandler ("onPlayerDamage", getRootElement(), function () if getElementData ( source, "GodO.Health" ) == "yep!" then cancelEvent() end ) Its not client side script, its server side.
-
function returnLoginAjax(email, password) if callRemote ("http://portalgamer.net.br/admin/sources/base/mta.php?acao=login", returnLoginAjax, email, password) then local account = getAccount(email, password) if logIn (account, password) == true then triggerClientEvent (source, "hideWindow", getRootElement()) end end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, returnLoginAjax) I added an if statement but this won't fix the problem tho, the email and password are nil means that they are not defined or you are sending them incorrectly. EDIT: Just found out that player was not defined so I changed it.
-
no we have maded an afk zone where you can walk and chill but i wanne make it like you geth there with /afk as teleporter and when you do /afk you get godmode and take off all weapons or isnt that possible? Yes. addCommandHandler( "afk", function ( thePlayer ) setElementPosition( thePlayer, 1904.8403320313, 717.12438964844, 49.214366912842 ) setElementFrozen ( thePlayer , true ) outputChatBox( "You are now in Afk zone", thePlayer, 0, 255, 0 ) for i=1, 46 do takeWeapon( thePlayer, i ) end setElementData ( thePlayer, "GodO.Health", "yep!" ) end ) addEventHandler ("onPlayerDamage", getRootElement(), function () if getElementData ( source, "GodO.Health" ) == "yep!" then cancelEvent() end )
-
Client side addEventHandler("onClientVehicleDamage", root, function (attacker, weapon, loss, x, y, z, tyre) if weapon == 0 then local veh = getVehicleController ( source ) or source local theKiller = getPlayerName ( attacker ) local thePSource = getPlayerName ( veh ) for _, v in ipairs( getElementsByType ( "player" ) ) do if getElementData ( v, "adminism") == "Admin" then triggerServerEvent (v, "onAdminMessageRec", v, tostring ( theKiller ), tostring ( thePSource ) ) -- source is admin ^ end end end end ) server side for _, v in ipairs( getElementsByType ( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData ( v, "adminism", "Admin") else setElementData ( v, "adminism", nil) end end addEventHandler("onPlayerJoin", getRootElement(), local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData ( source, "adminism", "Admin") else setElementData ( source, "adminism", nil) end end ) addEvent ("onAdminMessageRec", true ) addEventHandler ("onAdminMessageRec", getRootElement(), function ( theKiller, thePSource ) outputChatBox ( theKiller.." has punched ".. thePSource .."'s Vehicle", source, 255, 255, 0, false ) end ) It should work this time if still no Luck then débug the script.
-
Do you really think one can write 20 - 30 lines in 1 second or you think that I'm a newbie ? Oh well I don't care.
-
I fixed it already.
-
Hmm not sure but maybe try this. -- Client Sided addEventHandler("onClientVehicleDamage", root, function (attacker, weapon, loss, x, y, z, tyre) local veh = getVehicleController ( source ) or source local theKiller = getPlayerName ( attacker ) local thePSource = getPlayerName ( veh ) for _, v in ipairs( getElementsByType ( "player" ) ) do if getElementData ( v, "adminism") == "Admin" then triggerServerEvent (v, "onAdminMessageRec", v, tostring ( theKiller ), tostring ( thePSource ) ) -- source is admin ^ end end end ) -- Server Sided for _, v in ipairs( getElementsByType ( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData ( v, "adminism", "Admin") end end addEventHandler("onPlayerJoin", getRootElement(), local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then setElementData ( source, "adminism", "Admin") end end ) addEvent ("onAdminMessageRec", true ) addEventHandler ("onAdminMessageRec", getRootElement(), function ( theKiller, thePSource ) outputChatBox ( theKiller.." has punched ".. thePSource .."'s Vehicle", source, 255, 255, 0, false ) end )
-
No problem. You seem to be interested in lua so if you need help with anything let me know then.
-
function test () outputChatBox ("Say Hello to " ..getPlayerName (source).." : D", getRootElement()) -- getRootElement() will send message to everyone end addEventHandler ("onPlayerJoin", getRootElement(), test) -- syntax for event Handler is (EventName, AttachTo, functionName )
-
You mean putting players in jail if their wanted point is X?
-
sorry to tell you but its not ROOT, use getRootElement() even if you did it on purpose but just think how will newbies understand.
-
object = createObject(980, 3283.3999023438, 261.10000610352, 14.10000038147) marker = createMarker(3284, 261.29998779297, 1, "cylinder", 2, 100, 0, 0, 100) function gateo(hitElement) if getElementType ( hitElement ) == "player" and getTeamName(getPlayerTeam(hitElement)) == "Team" then moveObject(object, 2500, 3283.3999023438, 261.10000610352, 14.10000038147, 5) end end addEventHandler("onMarkerHit",marker,gateo) function gateo(hitElement) if getElementType ( hitElement ) == "player" and getTeamName(getPlayerTeam(hitElement)) == "Team" then moveObject(object,2500, 3283.3999023438, 261.10000610352, 14.10000038147) end end addEventHandler("onMarkerLeave",marker,gatec) More checks, less chances for the script to fail.
-
function check3DDistance(leader) local pX, pZ, pY = getElementPosition( leader ) local bX, bZ, bY = getElementPosition( source ) outputChatBox ( "the distance between "..getPlayerName(leader).." and the zombie is of "..getDistanceBetweenPoints3D ( pX, pZ, pY, bX, bZ, bY ) ) end addEventHandler("onBotFollow", getRootElement(), check3DDistance)
-
Yep and that's how I detect DD kills.
