-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
No hay de que.
-
addEventHandler ( "onResourceStart", resourceRoot, function () local gate1 = createObject(971, 0, 0, 5) local gate2 = createObject(971, 0, 0, 5) local Car1 = createVehicle ( 567, -1736, -2895, 55, 0, 0, 236 ) local Car2 = createVehicle ( 567, -1744, -2913.3000488281, 55, 0, 354.488, 220 ) attachElements( gate1, Car1, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( gate2, Car2, 0.4, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( Car1, 1087 ) addVehicleUpgrade ( Car2, 1087 ) end) function attach(thePlayer) if not isPedInVehicle(thePlayer) then return end local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then local vehicle = getPedOccupiedVehicle(thePlayer) local car1gate1 = createObject(971, 0, 0, 5) local car1gate2 = createObject(971, 0, 0, 5) attachElements( car1gate1, vehicle, 0.4, 6.2, -0.6, 90, 90, 90 ) attachElements( car1gate2, vehicle, 0.4, 13.2, -0.6, 90, 90, 90 ) addVehicleUpgrade ( vehicle, 1087 ) end end addCommandHandler ( "spatula", attach) You we're attaching the spatula 1 to both vehicles.
-
addEvent("bus_finish",true) addEventHandler("bus_finish",rootElement, function (client) if not isPedInVehicle(client) then return end if not busses[getElementModel(getPedOccupiedVehicle(client))] then return end givePlayerMoney(client, 200) outputChatBox ("Ganaste $200 por subir a un pasajero al bus.", client, 0,255,0) if #busTable1 == tonumber(getElementData(client,"busTable1")) then setElementData(client,"busTable1",1) else setElementData(client,"busTable1",tonumber(getElementData(client,"busTable1"))+1) end getNewBusLocation(client, math.random(#busTable1)) end)
-
You're welcome .
-
The function: isPlayerFrozen does not exists, maybe you meant isElementFrozen.
-
I don't know what do you mean by refresh their status, are you talking about of some kind of panel that lists the resources & their state?
-
function() local Name = getPlayerName( source ) local Table2 = executeSQLSelect ( "Datenbank2", "*", "Name = '"..Name.."'" ) executeSQLUpdate( "Datenbank2", "Geld = '"..getPlayerMoney( source ).."'","Name = '".. Name "'" ) end )
-
Yes, I had the same idea Benxamix.
-
Sounds like the 'source' of onZombieSpawn is a player, I don't get it, why isn't a zombie?
-
If you want to freeze everyone but YOURSELF, then use this: local frozeTime = 60 -- Seconds as frozen local timeLeft = {} local timeLeftText = {} addEvent("Froze", true) addEventHandler("Froze", root, function() if getPlayerMoney(source) >= 2000 then local players = getElementsByType("player") takePlayerMoney(source, 2000) outputChatBox("All players successfully frozen", source, 255, 255, 0, true) for theKey,thePlayer in ipairs(players) do if (thePlayer ~= source) then setElementFrozen(thePlayer, true) setElementData(thePlayer, "Timeleft", tonumber(frozeTime)) showTimeLeft(thePlayer) end end else outputChatBox("Not enough money.", source, 255, 0, 0, true) end end) function showTimeLeft(player) timeLeft[player] = textCreateDisplay() textDisplayAddObserver(timeLeft[player], player) timeLeftText[player] = textCreateTextItem("Time left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255) textDisplayAddText(timeLeft[player], timeLeftText[player]) setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player) end function updateTimeLeft(player) setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1) textItemSetText(timeLeftText[player], "Time left: " .. getElementData(player, "Timeleft")) if tonumber(getElementData(player, "Timeleft")) == 0 then textDestroyDisplay(timeLeft[player]) setElementFrozen(player, false) end end
-
I could maybe help you with some things, I'm pretty busy, but I can still help you for a fair price.
-
local frozeTime = 60 -- Seconds as frozen local timeLeft = {} local timeLeftText = {} addEvent("Froze", true) addEventHandler("Froze", root, function() if getPlayerMoney(source) >= 2000 then local players = getElementsByType("player") takePlayerMoney(source, 2000) outputChatBox("All players successfully frozen", source, 255, 255, 0, true) for theKey,thePlayer in ipairs(players) do setElementFrozen(thePlayer, true) setElementData(thePlayer, "Timeleft", tonumber(frozeTime)) showTimeLeft(thePlayer) end else outputChatBox("Not enough money.", source, 255, 0, 0, true) end end) function showTimeLeft(player) timeLeft[player] = textCreateDisplay() textDisplayAddObserver(timeLeft[player], player) timeLeftText[player] = textCreateTextItem("Time left: " .. getElementData(player, "Timeleft"), 0.45, 0.1, "high", 255, 255, 255, 255) textDisplayAddText(timeLeft[player], timeLeftText[player]) setTimer(updateTimeLeft, 1000, getElementData(player, "Timeleft"), player) end function updateTimeLeft(player) setElementData(player, "Timeleft", getElementData(player, "Timeleft") - 1) textItemSetText(timeLeftText[player], "Time left: " .. getElementData(player, "Timeleft")) if tonumber(getElementData(player, "Timeleft")) == 0 then textDestroyDisplay(timeLeft[player]) setElementFrozen(player, false) end end
-
-- server side: addEvent("onZombieSpawn",true) addEventHandler("onZombieSpawn",root, function () if (source and getElementType(source) == "ped") then giveWeapon(source, 8, 1, true) end end) I'm not sure if it'll work.
-
That doesn't make any sense. @directshot: The script himself can't do this, you must create a scoreboard column and then update it with the player's level, I suggest you to take some time to learn the basics of LUA and then try to achieve this.
-
The script should check if you have "team" account data and if so, it set's your team to that, else it sets to "Team 1".
-
You're welcome. P.S: It should work.
-
function setTeam() local account = getPlayerAccount(source) local team = getAccountData (account, "team") if (team) then setPlayerTeam(source, getTeamFromName(team)) else setPlayerTeam(source, getTeamFromName("Team 1")) end end addEventHandler("onPlayerLogin",root,setTeam) function save() local team = getPlayerTeam(source) local account = getPlayerAccount(source) if (team) and not isGuestAccount(account) then setAccountData(account, "team", getTeamName(team)) end end addEventHandler ( "onPlayerLogout", root, save )
-
Post your saving team part.
-
You got started the resource called: exp_system, right? because if not, it won't work.
-
You're welcome.
-
Ok, then use this: -- script.lua addEventHandler("onPlayerWasted",root, function (_,killer) if (killer and killer ~= source) then exports.exp_system:addPlayerEXP(killer,5) end end) -- meta.xml: "Castillo" type="script" version="1.0"/> With these two codes you must create a new RESOURCE in your "resources" folder, there you must create two files, one called: script.lua and other called meta.xml after that, copy the code from here and paste it in the respective file.
-
Can you please tell us for what you want to use this resource? you want to level up with what? killing players? zombies?
-
This resource won't work MAGICALLY, it has EXPORTED fuctions that you can use for y our own purposes. If you would have READ the description of the resource, you could have noticed that it wasn't a magic script. Exported functions (server-side only): getPlayerLevel -> arguments: thePlayer setPlayerLevel ->arguments: thePlayer, theLevel getPlayerEXP -> arguments: thePlayer setPlayerEXP -> arguments: thePlayer, theExperience addPlayerEXP -> arguments: thePlayer, theExperience A way of using it with zombies by Slothman: addEvent("onZombieWasted",true) addEventHandler("onZombieWasted",root, function (killer) exports.exp_system:addPlayerEXP(killer,5) end)
