-
Posts
1,105 -
Joined
-
Last visited
Everything posted by Aibo
-
well you're not putting the player into the vehicle. and it is best to name your markers and handler functions according to their purpose. what if you'll need another marker, you'll call it myMarker2? in the end it can get messy and hard to read even for yourself. local vehicleMarker = createMarker(1552.33, -1605.37, 12.382, 'cylinder', 2.0, 255, 0, 0, 150 ) function vehicleMarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" and not isPedInVehicle(hitElement) then local vehicle = createVehicle(432, 1552.33, -1605.37, 12.382) warpPedIntoVehicle(hitElement, vehicle) elseif getElementType( hitElement ) == "vehicle" then end end addEventHandler( "onMarkerHit", vehicleMarker, vehicleMarkerHit )
-
onPlayerContact source is a player. why getVehicleOccupant(source)?
-
well post the code where you make the gate move first.
-
you can't just add and expect it to work as you want. these are just examples.
-
something like this: views = { { 1515, -1636, 22.153465271, 1550, -1675, 9.881813049316 }, -- first view { 1515, -1636, 22.153465271, 1550, -1675, 9.881813049316 }, -- second view (change coordinats obviously) { 1515, -1636, 22.153465271, 1550, -1675, 9.881813049316 }, -- third, etc timer = false, -- view changing timer will be here current = 0 -- current view will be stored here } -- then views.timer = setTimer(function() local new = views.current == #views and 1 or views.current + 1 -- switch to view 1 if the last view is active or switch to next view setCameraMatrix(views[new][1], views[new][2], views[new][3], views[new][4], views[new][5], views[new][6]) views.current = new -- set new view as current end, 5000, 0) -- when you'll need to stop killTimer(views.timer) PS: while i was writing, Solidsnake14 already posted. but you forgot camera facing coordinates
-
see https://wiki.multitheftauto.com/wiki/MoveObject there are optional rotation parameters, use them.
-
and what will happen when player leaves? or when another join? MTA uses element system and that system work pretty nice, i dont get why people try to complicate things with IDs.
-
you're comparing a table "lang" with a string
-
you're not passing any coordinates of the click, and getting ground position at player position. and ground is not an element, so it will not trigger onElementClicked event. you can try using onPlayerClick event, though i really dont see a point in involving server in something that can be done clientside entirely.
-
lang = { ar = "Arabic", en = "English", fr = "French" }
-
что я делаю не так?
-
its just an example, you can add to any group that have access to kickPlayer. just see which group has and add your resource to that group. its just people tend to add resources in Admin group so they wont have any access restrictions.
-
that edit would give access to kickPlayer to everyone and everything. you should add your rersource to some group (for example "Admin") that have the access to kickPlayer: <group name="Admin"> ... <object name="resource.yourResourceName" /> </group>
-
What are ANSI and UTF-8?? No need to turn this topic into Lesson Topic. Just pm me.. what editor are you using for scripting? if windows notepad — when saving, make sure encoding is not UTF-8 but ANSI (look for dropdown in save dialog). also: dont use windows notepad.
-
check your logs and ACL, probably your resource does not have access to kickPlayer function.
-
in client script line 35 should be: triggerServerEvent ( "OnPlayerPressingButton", getLocalPlayer()) because right now you're triggering event from the root, and passing a nil argument playerContinue (you dont need to put function name in when triggering the event) and serverside part should be: function playerContinue () local playersRed = countPlayersInTeam ( teamRed ) local playersBlue = countPlayersInTeam ( teamBlue ) if playersRed == playersBlue then setPlayerTeam ( source, teamRed ) elseif playersRed > playersBlue then setPlayerTeam ( source, teamBlue ) elseif playersRed < playersBlue then setPlayerTeam ( source, teamRed ) end end addEvent ( "OnPlayerPressingButton", true ) addEventHandler ( "OnPlayerPressingButton", getRootElement(), playerContinue )
-
local variables have a scope limited to the block where they are declared (such as script files, functions, if statements, loops, etc). so outside of that block they are either nil or have some other value if defined. and testVar = "helo" will be a "global" variable for all script files in a resource (separated only by server/client side). some examples: local a = "one" -- variable is local to the script file b = "banana" -- variable is global for the resource outputChatBox(a) -- a is "one" if true then local a = "two" -- adding local a variable inside "if" block local c = "bleh" -- and some othe local variable outputChatBox(a) -- now this a is "two" outputChatBox(c) -- "bleh" end outputChatBox(a) -- outside that "if" block a is still "one" outputChatBox(c) -- and c is nil -- in some other same-side script file in the same resource: outputChatBox(a) -- nil outputChatBox(b) -- "banana"
-
you should post the part that triggers this event, obviously thePlayer is not what you expect it to be.
-
read about element data: https://wiki.multitheftauto.com/wiki/Element_data you should sometimes click the functions highlighted in the code here.
-
check your lua file encoding then. like ANSI or UTF-8
-
lines 12,14,16,18: if statement does not work that way. also missing "end"s: local hqEnter = createMarker ( -1944.1850585938, 883.42474365234, 40.861415863037, 'arrow', 1, 0, 255, 0, 150 ) local hqExit = createMarker ( -1937.171875, 883.54663085938, 32.687938690186, 'arrow', 1, 0, 255, 0, 150 ) local hqAdminEnter = createMarker (-1965.48828125, 880.1640625, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqAdminExit = createMarker (-1966.7939453125, 880.14501953125, 21.552816390991, 'corona', 1, 0, 255, 0, 0) local hqPartyGuns = createMarker (-1950.0562744141, 877.08581542969, 28.183406829834, 'cylinder', 1, 255, 0, 0, 150) local hqAdminGuns = createMarker (-1980.4031982422, 879.88684082031, 20.843906402588, 'cylinder', 1, 0, 255, 0, 150) -------------------------- function Enter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Member' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'V.I.P' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) elseif isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1935, 884, 33 ) outputChatBox ( "Entering to the Room Test1",hitPlayer ) else outputChatBox ( "Error Test1!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqEnter, Enter ) function Exit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1945, 884, 40 ) end addEventHandler( "onMarkerHit", hqExit, Exit ) --------------------------------------------- function adminEnter( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then setElementPosition ( hitPlayer, -1967, 881, 22 ) outputChatBox ( "Entering to the Room Test2",hitPlayer ) else outputChatBox ( "Error Test2!",hitPlayer ) end end addEventHandler( "onMarkerHit", hqAdminEnter, adminEnter ) function adminExit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, -1962, 881, 22 ) end addEventHandler( "onMarkerHit", hqAdminExit, adminExit ) --------------------------------------------- function partyGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Moderator' ) ) then giveWeapon( hitPlayer, 29, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 17, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 5, 1 ) setElementHealth ( hitPlayer, 1000 ) end -- missing end -- missing addEventHandler( "onMarkerHit", hqPartyGuns, partyGuns ) function adminGuns( hitPlayer, matchingDimension ) local account = getPlayerAccount(hitPlayer) if isObjectInACLGroup( 'user.'..getAccountName( account ), aclGetGroup( 'Admin' ) ) then giveWeapon( hitPlayer, 28, 10000 ) giveWeapon( hitPlayer, 31, 10000 ) giveWeapon( hitPlayer, 34, 10000 ) giveWeapon( hitPlayer, 39, 10000 ) giveWeapon( hitPlayer, 46, 10000 ) giveWeapon( hitPlayer, 9, 1 ) setElementHealth ( hitPlayer, 1000 ) end -- missing end -- missing addEventHandler( "onMarkerHit", hqAdminGuns, adminGuns )
-
why are you using hitPlayer but then getting local player element data? maybe i dont understand the purpose of this (actually, i dont), but what if some other player hits the marker? and what is the source in the second part? ps: clientside outputChatBox does not have any element input parameters, it outputs to local player only.
-
this issue was fixed on IRC, basically playername = getPlayerName(source) was outside any handler function, so "source" was nil. just for people to know.
-
"help" is like "make it for you"?
-
what's so hard in this? ps: it is badly made as it is and where's the weapon selection bar?
