Jump to content

Gtagasje

Members
  • Posts

    141
  • Joined

  • Last visited

Details

  • Location
    The Netherlands

Recent Profile Visitors

555 profile views

Gtagasje's Achievements

Poot-butt

Poot-butt (14/54)

1

Reputation

  1. I think he means when 1 player spawns a new vehicle, all the old vehicles get deleted, instead of just the one of the player who spawned a second vehicle. If this is the case, you should make a table which keeps track of all the vehicles that have been spawned and link the player ID (thePlayer) with the vehicle in the table. This way you can later destroy only the vehicle of the player it was linked to.
  2. As far as I know there is no way to play videos of any sort ingame.
  3. On the wiki there is an example which should do what you want. https://wiki.multitheftauto.com/wiki/GetPlayerPing function kickPing() -- Creates a function called kickPing for i, player in ipairs(getElementsByType("player")) do -- Loop every player if (getPlayerPing(player) >= 500) then -- If their ping is over 500 kickPlayer(player, "Ping over 500!") -- Kick them end end end setTimer(kickPing, 5000, 0) -- Every 5 seconds, the kickPing function is called.
  4. I meant, what you are doing is when the player hits the marker, you check the "vehicles" data and the "Occupation" data of that marker, and if they're equal, you continue the function. But when you create the marker, you only set the "vehicles" data to the corresponding role (v.role) and you don't set the "Occupation" data anywhere(as far as I can see.) This would mean that when you try and get their data's, "vehicles" would return the correct role, and "Occupation" would return nill thus the function discontinues. So what I did was checking the "vehicles" data of the marker, and the "Occupation" data from the player, so if the player has the job the marker spawns vehicles for, the function continues, and otherwise it doesn't. Your script doesn't check the job of the player anywhere.
  5. You need the "onClientGUIClick" event
  6. local Marker = createMarker(v.mx, v.my, v.mz, "cylinder", 1.5, v.mr, v.mg, v.mb) setElementData(Marker, "vehicles",v.role) Are you even setting the marker "Occupation" data to the correct job? Because it seems like you mean to check the occupation of the player, and not the marker. In that case you should use this local Marker = createMarker(v.mx, v.my, v.mz, "cylinder", 1.5, v.mr, v.mg, v.mb) setElementData(Marker, "vehicles",v.role) addEventHandler("onClientMarkerHit", Marker, vehicleMarkerHit) function vehicleMarkerHit(hitElement) if hitElement == localPlayer then if getElementData(source, "vehicles") == getElementData(localPlayer, "Occupation") then guiSetVisible(window[1],true) showCursor(guiGetVisible(window[1])) end end end
  7. Gtagasje

    Fix

    You should use the following functions if you want to do that (serversided script) getPlayerAccount() -- Retrieve the player's account setAccountData() -- Set an account data key to a value to check if the player has joined before or not getAccountData() -- When the player logs in, check his account data to see if he has joined earlier or not (the key you set with setAccountData "onPlayerLogin" -- The event to trigger the checking if the player has joined before or not and if not set his account data to a value that he has joined and is not new.
  8. If I read it right on the wiki, getVehicleController will check forwards in the 'towing chain' if the vehicle you're checking does not have a driver. So it should still return true because you're driving the towtuck which is forwards in the chain. (If that makes sense.) So you could use this local myshape = createColCircle(1049.6279296875, -1029.674804687, 4) function ColHit(hitElement) if getElementType(hitElement) == "vehicle" then if not getVehicleOccupant(hitElement) then destroyElement(hitElement) end end end addEventHandler("onColShapeHit", myshape, ColHit)
  9. If you want to disable damage in interiors you can just use these: "onClientPlayerDamage" -- Triggers when a player is damaged getElementInterior() -- Check if the player is in an interior or outside(interior 0) cancelEvent() -- If yes, cancel the damage Make sure this script is clientside.
  10. function raceConsider(thePlayer, cmd) if thePlayer and cmd and cmd == "gorace" then -- It was activated by command else -- It was not activated by command if getPlayerCount() >= 1 and raceActive["aktivs"] == false then raceActive["aktivs"] = true setTimer ( needRaceGUI, 5000, 1) outputChatBox("DEBUG:[1]", root, 255, 255, 0) end end end addEventHandler ( "onPlayerJoin", getRootElement(), raceConsider ) addCommandHandler("gorace", raceConsider)
  11. You could check the tick count when the player starts driving, and then while his speed is lower than 101 you check if his speed is 100, incase that's true, you break the loop and check the tickcount again. Something like this function getElementSpeed(element,unit) -- From the wiki, [url=https://wiki.multitheftauto.com/wiki/GetElementSpeed]https://wiki.multitheftauto.com/wiki/GetElementSpeed[/url] if (unit == nil) then unit = 0 end if (isElement(element)) then local x,y,z = getElementVelocity(element) if (unit=="mph" or unit==1 or unit =='1') then return (x^2 + y^2 + z^2) ^ 0.5 * 100 else return (x^2 + y^2 + z^2) ^ 0.5 * 1.8 * 100 end else outputDebugString("Not an element. Can't get speed") return false end end --Start these when the player starts driving while getElementSpeed(player) < 2 do if getElementSpeed(player) == 1 then curCount = getTickCount() end end while getElementSpeed(player) < 101 do if getElementSpeed(player) == 100 then newCount = getTickCount() break end end speedupTime = (newCount - curCount)/1000 (I've never used while loops though, so I'm not 100% sure whether or not it works.)
  12. Regarding the trains, you could attach a colshape to the train which sticks out a little on the train (longer, not wider) and when the player hits that colshape you could kill it. createColRectangle() -- Create the colshape attachElements() -- Attach it to your train "onColShapeHit" -- Serversided event, triggered when a player hits a colshape killPed() -- Kill the player
  13. I've never done anything with the race gamemode nor looked at it, but I think you can just remove the countdown and instantly trigger the function that starts the next map. So you would have to select a random map yourself (instead of letting the people select one by triggering the select function) and then start that one.
  14. I'm not sure if this would work (don't have time to test it) but you could atleast try it. local charTable = {["\\"] = true, ["|"] = true, ["/"] = true, ["@"] = true, ["#"] = true, ["~"] = true, ["!"] = true, ["\""] = true, ["$"] = true, ["%"] = true, ["&"] = true, ["("] = true, [")"] = true, ["["] = true, ["]"] = true, ["="] = true, ["?"] = true, ["+"] = true, ["-"] = true, ["*"] = true, ["."] = true, ["'"] = true} if newNick:find("%W") and not charTable[newNick:find("%W")] then Basically you add all the allowed characters in a table, and then check that if a non-alphanumerical character is found and it's not in the table then you cancel it.
  15. If you mean you want to do that for every sql insert you do, you could use this perhaps. Keep in mind that the old value can't be a player element for example, if you want it to be a player's name you should send the name of the player with the function, and not the player element. function setSQLData(column, oldvalue, newvalue) local dbname = "YOUR DATABASE NAME HERE" -- Fill in the database name local column, oldvalue, newvalue if type(column) == "string" then if type(oldvalue) ~= "string" then -- Make sure everything is a string oldvalue = tostring(oldvalue) end if type(newvalue) ~= "string" then -- Idem newvalue = tostring(newvalue) end local sh = executeSQLQuery("SELECT * FROM ?? WHERE ? = ?", dbname, column, oldvalue) -- Check if the entry already exists if #sh == 0 or not sh then local ih = executeSQLQuery("INSERT INTO ??(?) VALUES(?)", dbname, column, newvalue) -- Nope, insert it return ih else local uh = executeSQLQuery("UPDATE ?? SET ? = ? WHERE ?", dbname, column, newvalue, oldvalue) -- Yes, update it return uh end else return false -- Woops, the column name you provided is not a string end return false end
×
×
  • Create New...