Jump to content

justn

Members
  • Posts

    525
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by justn

  1. function create() local main = createObject ( 2983, -1330.6999511719, -29.39999961853, 13, 0, 1.5, 0 ) local top = createObject ( 2985, -1331.0999755859, -29.39999961853, 12.9, 0, 13.75, 0 ) veh = createVehicle ( 457, -1330.7998046875, -31.099609375, 14.2, 0, 0, 271.99951171875 ) if ( veh ) then attachElements(veh, top, 0,-1.6,2,0,0,271.99951171875) setElementAlpha(veh, 0) setElementData(veh, "top", "21 nigga") end end addEventHandler ( "onResourceStart", resourceRoot, create ) function check(plr,cmd) local test = getElementData(veh, "top") outputChatBox(test) end addCommandHandler("t", check) Hopefully this helps, by the way, you might wanna see what are 'elements' https://wiki.multitheftauto.com/wiki/Element
  2. Your code seems pretty messed up, like a lot. Also here's a small fix: function gui(btn,keyState) if (btn == "left") and (keyState == "down") then if (source == grid) then wybrany_row1 = guiGridListGetSelectedItem(grid) id = guiGridListGetItemText(grid, wybrany_row, 2) if tonumber(id) == nil then return end setElementModel(ped, tonumber(id)) end end end addEventHandler("onClientGUIClick",root,gui) function manageGUI(key,keyState) if ( keyState == "down" ) then if ( key == "enter" ) then -- do what you want here when the player presses enter elseif ( key == "backspace" ) then -- do what you want here when the player presses backspace end end end bindKey("backspace", "down", manageGUI) bindKey("enter", "down", manageGUI) PM or Contact me on skype so I can help you a bit more with this.
  3. Well, if the you mean that the marker and object will be in the same position and you want them both to go up and down at the same time, you can simply use: attachElements -- Attach the marker to the object. And once you've done that, you could just move the object using moveObject to whatever position you'd like, and then use setTimer so 1 second after the object & marker is completely moved to the position you'd like it to be in , then you would be able to do whatever you'd like to the object in a new function. Hope this helped.
  4. Here you go. local pilot = { {414.2, 2533.5, 18.1}, -- VM Airport {1449.92236, -2287.12622, 12.3}, -- LS Airport {-1226.55, 55.48, 13.13}, -- SF Airport } function attachBlips() local markerSize = 1.5 local r, g, b = 255, 255, 0 for i,v in ipairs(pilot) do local marker = createMarker(v[1], v[2], v[3], "cylinder", markerSize, r, g, b, 255) local blip = createBlipAttachedTo(marker, 56) end end addEventHandler("onResourceStart", root, attachBlips)
  5. Hey guys I'm presenting you my latest map called 'Beyond Nature', hope you like it ! Thanks Dimi (DesignRecords) for the Record!
  6. Don't see why you used getElementPosition when you're not gonna use it. local theVehicle = {} local marker = createMarker( 1920.599609375, 1310.099609375,8, "cylinder", 2, 0 ,0, 255, 155) function vehicle(thePlayer) if (getElementType(thePlayer) == "player") then if ( isPedInVehicle(thePlayer) ) then return end if isElement( theVehicle[thePlayer] ) then destroyElement( theVehicle[thePlayer] ) end theVehicle[thePlayer] = createVehicle(470, 1921.599609375, 1298.599609375, 9.3999996185303, 0, 0, 270 ) outputChatBox ( "This is a free vehicle. Spawning another one will destroy this vehicle.", thePlayer, 0, 0, 255 ) warpPedIntoVehicle(thePlayer, theVehicle[thePlayer]) end end addEventHandler("onMarkerHit", marker, vehicle)
  7. Hi guys, I made a team script a long time ago, and my friend wanted me to add, so he can set it 'true' or 'false' so the team can be enabled, I don't know why, but the script does not work, when I start the script, nothing happens. local Teams = { {"#US'", "#US' Unbeatable Skills", "#406188", "Unbeatable Skills", true }, {"TEST|", "TEST CLAN", "#123321", "TEST CLAN", false }, -- Clan tag, Team name, clan color, clan name, team enabled } addEventHandler("onResourceStart",root, function() for i,p in ipairs(getElementsByType("player")) do for i,v in ipairs(Teams) do if ( string.match(getPlayerName(p), v[1])) then if ( v[5] == true ) then local r,g,b = getColorFromString(v[3]) local team = createTeam(v[2],r,g,b) setPlayerTeam(p,team) end setElementData(p,"us:clan",v[4]) setTimer(function() for i,v in ipairs(getElementsByType("team")) do if countPlayersInTeam(v) == 0 then destroyElement(v) end end if ( isElement(p) ) and ( getElementType(p) == "player" ) then if ( string.match ( getPlayerName(p), v[1])) then if ( getPlayerTeam(p) ) then if ( not getTeamName(getPlayerTeam(p)) == v[2] ) then if ( not getTeamFromName(v[2]) ) then local r,g,b = getColorFromString(v[3]) local team = createTeam(v[2],r,g,b) setPlayerTeam(p,team) setElementData(p,"us:clan",v[4]) else setPlayerTeam(p,getTeamFromName(v[2])) setElementData(p,"us:clan",v[4]) end else setPlayerTeam(p,getTeamFromName(v[2])) setElementData(p,"us:clan",v[4]) end else if ( getTeamFromName(v[2])) then setPlayerTeam(p,getTeamFromName(v[2])) setElementData(p,"us:clan",v[4]) else local r,g,b = getColorFromString(v[3]) local team = createTeam(v[2],r,g,b) setPlayerTeam(p,team) setElementData(p,"us:clan",v[4]) end end end end end,1000,0) end end end end ) --ERROR: [uS]/us-teams/server.lua:20: bad argument #1 to 'match (string expected, got boolean) addEventHandler("onPlayerJoin",root, function() for i,v in ipairs (Teams) do if ( string.match(getPlayerName(source), v[1])) then if ( not getTeamFromName(v[2])) then local r,g,b = getColorFromString(v[3]) local team = createTeam(v[2],r,g,b) setPlayerTeam(source,team) else setPlayerTeam(source,getTeamFromName(v[2])) end setElementData(source,"us:clan",v[4]) end end end ) addEventHandler("onPlayerChangeNick",root, function(old,new) for i,v in ipairs(Teams) do if new then if string.match(new, v[1]) then if ( getTeamFromName(v[2]) ) then setPlayerTeam(source, getTeamFromName(v[2])) setElementData(source,"us:clan",v[4]) break else local r,g,b = getColorFromString(v[3]) local team = createTeam(v[2],r,g,b) if ( team ) then setPlayerTeam(source, getTeamFromName(v[2])) setElementData(source,"us:clan",v[4]) break end end else local playerTeam = getPlayerTeam(source) if ( playerTeam) then setPlayerTeam(source,nil) setElementData(source,"us:clan",nil) if ( countPlayersInTeam(playerTeam) == 0 ) then destroyElement(playerTeam) end end end end end end ) addEvent("onPlayerTeamChange"); local _setPlayerTeam = setPlayerTeam; setPlayerTeam = function(player,team) local PreviousTeam = getPlayerTeam(player); local Result = _setPlayerTeam(player,team); if Result then triggerEvent("onPlayerTeamChange",player,PreviousTeam,team); end; return Result; end; addEventHandler ( "onPlayerTeamChange", root, function ( oldTeam, currentTeam ) if ( oldTeam ) then if ( countPlayersInTeam(oldTeam) == 0 ) then destroyElement(oldTeam) end end end ) addEventHandler("onPlayerQuit",root, function() for i,v in ipairs(getElementsByType("team")) do local teamNames = getTeamName(v) local teams = getTeamFromName(teamNames) if ( countPlayersInTeam ( teams ) == 0 ) then destroyElement(teams) end end end ) local clientCreated = fileCreate("client.lua") if ( clientCreated ) then fileWrite(clientCreated, "--All rights reserved for US\\ Unbeatable Skills (c) 2014") fileClose(clientCreated) end
  8. Hey guys, I'm working on a login panel to work with a website ( the player will need to register on website to log-in to server ) and I seem to have a few problems understanding what to do . My friend suggested me use these functions below but I don't understand how to use them well, so I would like if someone could help me. Thanks. dbConnect -- to connect to the forum database dbQuery -- to get the account name + pass dbPoll -- not really sure what this is for md5 -- also not sure what this is for -- The forum type is IPB ( Invasion Power Board ) Anyways, those were the functions he told me to use and I'd appreciate it if someone could help me with this, thanks.
  9. I tried this but it didn't work ( the bindKey part ) local isInvisible = true local objects = {} function toggleStatus() if ( isInvisible == true ) then for i,v in ipairs(getElementsByType("object")) do if ( getObjectScale(v) == 0 ) then setObjectScale(v, 1) objects[v] = true end end outputChatBox("#406188[Visibility]: #FFFFFFAll invisible parts are now #00ff00visible",255,255,255,true) isInvisible = false else for i,v in ipairs(getElementsByType("object")) do if getObjectScale(v) == 1 and objects[v] then setObjectScale(v, 0) objects[v] = nil end end outputChatBox("#406188[Visibility]: #FFFFFFAll visible parts are now #ff0000invisible",255,255,255,true) isInvisible = true end end addCommandHandler("visibility", toggleStatus) addEvent("onClientMapStarting",true) function onMapStarting(mapInfo) if ( isInvisible == false ) then for i,v in ipairs(getElementsByType("object")) do if ( getObjectScale( v ) == 0 ) then setObjectScale(v, 1) objects[v] = true outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188invisible",255,255,255,true) end end elseif ( isInvisible == true ) then for i,v in ipairs(getElementsByType("object")) do if ( objects[v] == true ) then objects[v] = nil outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188visible",255,255,255,true) end end end end addEventHandler("onClientMapStarting", root, onMapStarting) addEventHandler("onClientResourceStart",root, function () bindKey("i","down","visbility") isInvisible = true end ) addEventHandler("onClientPlayerJoin",root, function() bindKey("i","down","visibility") isInvisible = true end )
  10. When it was server-side and i used "onMapStarting" it worked.. x: i forgot to replace the table for isInvisible and I also forgot to remove the loop at line 51 v:
  11. Hi, So I was working on a little script, and the problem is, it doesn't work. I don't get any errors or anything, so yeah.. Code: function onMapStarting(mapInfo) if ( isInvisible[localPlayer] == false ) then for i,v in ipairs(getElementsByType("object")) do if ( getObjectScale( v ) == 0 ) then setObjectScale(v, 1) objects[v] = true outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188invisible",255,255,255,true) end end elseif ( isInvisible[localPlayer] == true ) then for i,v in ipairs(getElementsByType("object")) do if ( objects[v] == true ) then objects[v] = nil outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188visible",255,255,255,true) end end end end addEventHandler("onClientMapStarting", root, onMapStarting) //UPDATE: Here's the full code Code: local isInvisible = {} local objects = {} function toggleStatus() if ( isInvisible[localPlayer] == true ) then for i,v in ipairs(getElementsByType("object")) do if ( getObjectScale(v) == 0 ) then setObjectScale(v, 1) objects[v] = true end end outputChatBox("#406188[Visibility]: #FFFFFFAll invisible parts are now #00ff00visible",255,255,255,true) isInvisible[localPlayer] = false else for i,v in ipairs(getElementsByType("object")) do if getObjectScale(v) == 1 and objects[v] then setObjectScale(v, 0) objects[v] = nil end end outputChatBox("#406188[Visibility]: #FFFFFFAll visible parts are now #ff0000invisible",255,255,255,true) isInvisible[localPlayer] = true end end addCommandHandler("visibility", toggleStatus) function onMapStarting(mapInfo) if ( isInvisible[localPlayer] == false ) then for i,v in ipairs(getElementsByType("object")) do if ( getObjectScale( v ) == 0 ) then setObjectScale(v, 1) objects[v] = true outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188invisible",255,255,255,true) end end elseif ( isInvisible[localPlayer] == true ) then for i,v in ipairs(getElementsByType("object")) do if ( objects[v] == true ) then objects[v] = nil outputChatBox("#406188[Visibility]: #FFFFFFPress #406188'i' #FFFFFFto make your objects #406188visible",255,255,255,true) end end end end addEventHandler("onClientMapStarting", root, onMapStarting) addEventHandler("onClientResourceStart", root, function() for i,v in ipairs(getElementsByType("player")) do bindKey("i","down","visibility") isInvisible[v] = true end end ) addEventHandler("onClientPlayerJoin",root, function() isInvisible[localPlayer] = true end )
  12. You can't use them all at once.
  13. You just copied what everyone said.
  14. justn

    help me please!

    If you want all of this for free and you wanna copy other servers, I think it's fair enough you learn yourself. https://wiki.multitheftauto.com/wiki/Main_Page
  15. Nevermind, problem solved.
  16. justn

    [HELP] Pizza job

    I'm guessing this is what you want.. and 1 more thing, variables shouldn't be defined locally unless it is out of the function.. ( or if you're creating the thing / element for that function only ) pizzas = 8 refmarker = createMarker ( -1805, 944, 23.9, "cylinder", 1.5, 255, 25, 0, 170 ) refblip = createBlipAttachedTo(refmarker, 29) pizzasLeft = guiCreateLabel (0.82, 0.5, 5, 3.5, "Pizzas: "..pcount.."/8", true) function pay() if ( source == marker ) then pizzas = pizzas - 1 givePlayerMoney(5000) guiSetText(pizzasLeft, "Pizzas: " ..pizzas.."/8") destroyElement(marker) destroyElement(blip) destroyElement(pizzabox) outputChatBox("Get in a Pizza Boy to get a new mission", 255, 204, 0) end end addEventHandler ( "onClientMarkerHit", getRootElement(), pay ) function refill() if ( source == refmarker ) then if ( not pizzas == 8 ) then pizzas = 8 local pcount = tostring(pizzas) guiSetText(pizzasLeft, "Pizzas: " ..pcount.."/8") destroyElement(refmarker) destroyElement(refblip) end end end addEventHandler ( "onClientMarkerHit", getRootElement(), refill )
  17. setPlayerTeam is a server-sided function only, so therefore, you would need to trigger an event.
  18. justn

    Wanted event

    Nope it's not correct. local playerWantedLevel = getPlayerWantedLevel(source) setPlayerWantedLevel(source,playerWantedLevel+1)
  19. justn

    Wanted event

    Heh, don't really need to replace 'source' to 'client' He can simply use this: triggerServerEvent ( "wanted", localPlayer, weapon )
  20. Your new server-sided code, if the player is in "Console, Admin, SuperModerator or Moderator" then he won't be kicked. function kickPlayerOnHighPing() if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin" )) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Console" )) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator" )) or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator" )) then outputChatBox(getPlayerName(source) .. " was kicked due to high ping!", getRootElement(), 27, 89, 224, true) kickPlayer(source, "Your Ping was straight too high.") end end addEvent("kickPlayerOnHighPing", true) addEventHandler("kickPlayerOnHighPing", getRootElement(), kickPlayerOnHighPing)
  21. justn

    Help !

    I can help on the cw and dm if you like .. my skype: eminem.multitheftauto
  22. Whatever ping-kicker system you're using, you should edit the code, so if the player ( who is being kicked ) is not an admin, then he will be kicked.
  23. -- Global chat function globalMessage(thePlayer, cmd, ...) local message = table.concat ( { ... }, " " ); local name = getPlayerName(thePlayer); local account = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then outputChatBox("#FF0000[ADMIN]#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) else outputChatBox("#FF0000[GLOBAL]#00FF00"..name..": #FFFFFF"..message,root, 255, 255, 255, true) end end addCommandHandler("global", globalMessage); addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for index,player in pairs(getElementsByType("player")) do bindKey(player,"x", "down", "chatbox", "global"); end end) addEventHandler("onPlayerJoin", getRootElement(), function() bindKey(source, "x", "down", "chatbox", "global"); end )
×
×
  • Create New...