Jump to content

MrSecreto07

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by MrSecreto07

  1. Thank you so much @pa3ck I worked perfectly
  2. hi guys i have this script of lottery by Al3grab I want to use this resource but I have noticed that the players can buy the amount of tickets they want without any limit, I have tried several ways to make them only buy 1 ticket and so far I have not been able to even try the removeCommandHandler If anyone can help me on this I would appreciate it LOT_PRIZE_NUM = 1000 -- The lottery prize . LOT_PRIZE_PLUS = 100 -- If no one won the prize it will be increased , this is the plus number . LOT_PRIZE_PLUS_TIMES = 5 -- If no one won the prize it will be increased , this is how many times it will be increased -- LOT_TICKET_PRICE = 50 -- The Lottery ticket prize . LOT_NUM_LIMIT = 10 -- What is the higher lottery number . -- LOT_TIME_LIMIT_FROM,LOT_TIME_LIMIT_TO = 30,60 -- Random timer limit to start the lottery in seconds . LOT_RANDOM_NUMBER = 20 -- Random timer to make lottery in minutes . --- Script --- rRoot = resourceRoot -- LOT_NUM = nil LOT_PRIZE = nil LOT_ON = false LOT_INC = 0 LOT_TICKETS = {} LOT_WINNERS = {} -- function outLot(msg,to) if to then -- outputChatBox("**#00FF00[Lottery]#FFFF00 "..msg,to,255,0,0,true) else outputChatBox("**#00FF00[Lottery]#FFFF00 "..msg,root,255,0,0,true) end end function onLotStart() outputDebugString("Lottery By Al3grab | Started") -- local help = getResourceFromName("helpmanager") if not help then outLot("By Al3grab Started") else local state = getResourceState(help) if state == "running" then outLot("By Al3grab Started , Press F9 For Help") else outLot("By Al3grab Started") end end -- createRandomLot() end addEventHandler("onResourceStart",rRoot,onLotStart) function createRandomLot() local random:~ = math.random(1,tonumber(LOT_RANDOM_NUMBER)) if random:~ then outLot("Next Lottery Will Start in #00FFFF"..tonumber(random:~).."#FFFF00 Minutes") random:~Timer = setTimer ( createLot , random:~ * 60 * 1000 , 1 ) end end function createLot(prize) if random:~Timer then if isTimer(random:~Timer) then killTimer(random:~Timer) end end LOT_NUM_LIMIT = LOT_NUM_LIMIT or 30 prize = prize or LOT_PRIZE_NUM -- local lot = math.floor(math.random(1,tonumber(LOT_NUM_LIMIT))) local lotTime = math.floor(math.random(LOT_TIME_LIMIT_FROM,LOT_TIME_LIMIT_TO)) local lotTime = lotTime * 1000 if lot and lotTime then startLottery( lot , lotTime , prize or 50000 , LOT_PRIZE_PLUS or 5000 , LOT_TICKET_PRICE or 5000 ) end end addCommandHandler("lottery",function(me,cmd,prize) if hasObjectPermissionTo(me,"command.shutdown") then createLot(prize or nil) end end , false ,false ) function startLottery ( LotNumber , StartAfter , Prize , Plus , TicketPrice ) if ( LotNumber and StartAfter and Prize and Plus and TicketPrice ) then outLot("The Lottery Will Start in #00FFFF"..tonumber(math.floor(StartAfter/1000)).."#FFFF00 Seconds , The Prize is #00FF00"..Prize.."$") outLot("Use /Ticket <number (1-"..tonumber(LOT_NUM_LIMIT)..")> Command to buy a ticket , the ticket costs #00FF00"..TicketPrice.."$") LOT_NUM = LotNumber LOT_PRIZE = Prize LOT_INC = 0 LOT_ON = true setTimer( function () LOT_WINNERS = {} if ( LOT_TICKETS and type(LOT_TICKETS) == "table" ) then for k,v in ipairs ( LOT_TICKETS ) do local Player = v[1] local TicketNumber = v[2] if ( Player and TicketNumber ) then if TicketNumber == LOT_NUM then table.insert(LOT_WINNERS,Player) end end end -- if ( LOT_WINNERS ) then onLotteryFinish(LOT_WINNERS) end end end , StartAfter , 1 ) end end function onLotteryFinish ( table ) if ( table ) then outLot("The Lucky Number Was #00FFFF"..tonumber(LOT_NUM).."#FFFF00 !") if #table > 0 then outLot("Winners Are :") for k,v in ipairs ( table ) do if isElement(v) then outputChatBox("- "..getPlayerName(v),root,255,255,0,true) givePlayerMoney(v,LOT_PRIZE) end end -- destroyLottery(true) else outLot("No one won the lottery !") increaseLottery() end end end function increaseLottery() if ( tonumber(LOT_PRIZE_PLUS) ) then if LOT_INC ~= LOT_PRIZE_PLUS_TIMES then local LOT_INC = tonumber(LOT_PRIZE) + tonumber(LOT_PRIZE_PLUS) -- destroyLottery(false) outLot("Lottery has been increased to #00FF00"..tonumber(LOT_INC).."$#FFFF00 !") createLot(LOT_INC) -- LOT_INC = LOT_INC + 1 else destroyLottery(true) end end end function destroyLottery(startNew) LOT_NUM = nil LOT_PRIZE = nil LOT_ON = false LOT_INC = 0 LOT_TICKETS = {} LOT_WINNERS = {} -- if startNew then createRandomLot() end end addCommandHandler("ticket",function ( me , cmd , number ) if LOT_ON then if tonumber(number) and tonumber(number) >= 1 and tonumber(number) <= tonumber(LOT_NUM_LIMIT) then if getPlayerMoney(me) >= LOT_TICKET_PRICE then outputChatBox("**#00FF00[Lottery]#FFFF00 Your number is "..number.." good luck !",me,255,0,0,true) takePlayerMoney(me,LOT_TICKET_PRICE) -- table.insert(LOT_TICKETS,{me,tonumber(number)}) else outputChatBox("**#00FF00[Lottery]#FFFF00 You Don't have #00FF00"..tonumber(LOT_TICKET_PRICE).."$",me,255,0,0,true) end else outputChatBox("**#00FF00[Lottery]#FFFF00 Ticket number must be be between 1-"..LOT_NUM_LIMIT.."",me,255,0,0,true) end else outputChatBox("**#00FF00[Lottery]#FFFF00 No lottery is running now !",me,255,0,0,true) end end , false , false )
  3. Is worked the teams, thanks But I noticed a small error, the players that are not in one of those teams can use the command, they do not see anything in the chat but those who are in the teams if they can see what those players write.
  4. I created this code: function RadioChat ( thePlayer, cmd, ... ) local theTeam = getTeamFromName ( "Team1") if ( theTeam ) then local message = table.concat ( { ... }, " " ) local name = getPlayerName(thePlayer) local players = getPlayersInTeam ( theTeam ) for playerKey, playerValue in ipairs ( players ) do outputChatBox("(*RADIO*) " .. getPlayerName ( thePlayer ) .. " #ffffff"..message, playerValue, 0, 0, 255, true) end end end addCommandHandler ( "radio", RadioChat ) It's a chat radio that I want to be visible only to 4 teams. The only thing I lack is to be able to add the other teams, I tried several ways and they do not work. Try these and they did not work: local theTeam = getTeamFromName ( "Team1", "Team2", "Team3", "Team4") local theTeam = (getTeamFromName ( "Team1")) or (getTeamFromName ( "Team2")) or (getTeamFromName ( "Team3")) or (getTeamFromName ( "Team4")) someone help me?
  5. Can you be a bit more specific? It's just that I'm new to LUA
  6. Hi guys again How can I create a chat script that is visible only for 4 teams? Someone can help me by telling me which commands should I use
  7. it does not work I tried with each one of the anim of "sex" found in this blog: Http://forum.sa-mp.com/showthread.php?t=153659 In that list are found those that mentioned but when trying them did not work.
  8. The group "BLOWJOBZ" and "SNM" also do not exist in the wiki and if they work Examples: function animationCommand ( source ) setPedAnimation (source, "BLOWJOBZ", "BJ_COUCH_LOOP_W", -1, true, false, false ) end addCommandHandler ( "sex1", animationCommand ) function animationCommand ( source ) setPedAnimation (source, "SNM", "SPANKINGP", -1, true, false, false ) end addCommandHandler ( "sex2", animationCommand )
  9. Hello Community! I have a problem, I've been trying to make a sex script for a week but I still can not make it work. The animations within the "SEX" group do not work for me, those of the "SNM" group and "BLOWJOBZ" work perfectly, but the ones that interest me are SEX and I still can not find the reason why they do not work for me. function animationCommand ( source ) setPedAnimation (source, "SEX", "SEX_1_FAIL_W", -1, true, false, false ) end addCommandHandler ( "sex1", animationCommand ) function animationCommand ( source ) setPedAnimation (source, "SEX", "SEX_1_FAIL_P", -1, true, false, false ) end addCommandHandler ( "sex2", animationCommand )
  10. test this: <script src="main.lua" type="server" /> <script src="mainc.lua" type="client" />
  11. MrSecreto07

    Question

    Hello Community! I have a question and I would like to know who helps me ... Is there a way to make a script for a player to die when hit by a vehicle? In case if it can be done, I would like you to tell me the functions I need to do it.
  12. thank you guys Now works perfectly
  13. Hi guys! I need help I made this script so that when a player takes a marker he earns 30,000, the problem is that I add the destroyElement function to eliminate the marker when taking it, but I want to only delete the player that takes it and not all. local money2 = createMarker(-282.60000610352, 405.79998779297, 69.300003051758, 'corona', 7, 255, 0, 0, 255) setElementDimension (money2, 336) function playrules(thePlayer) givePlayerMoney (thePlayer, 35000) destroyElement(money2) end addEventHandler ( "onMarkerHit", money2, playrules ) Try creating it in client and also it was destroyed for all, besides that gave me error the givePlayerMoney: local money2 = createMarker(-282.60000610352, 405.79998779297, 69.300003051758, 'corona', 7, 255, 0, 0, 255) setElementDimension (money, 336) function MarkerHit ( thePlayer, amount ) givePlayerMoney (thePlayer, 35000) destroyElement(money2) end addEventHandler ( "onClientMarkerHit", money2, MarkerHit ) Who can help me to destroy the marker only to the player who takes it?
  14. hi community! I would like to know if anyone can help me, I want this glue script to work only for members of a team. I have tried everything and I can not do it, if you help me I would appreciate it. Client: function glue() local player = getLocalPlayer() if not getPlayerOccupiedVehicle(player) then local vehicle = getPlayerContactElement(player) if getElementType(vehicle) == "vehicle" then local px, py, pz = getElementPosition(player) local vx, vy, vz = getElementPosition(vehicle) local sx = px - vx local sy = py - vy local sz = pz - vz local rotpX = 0 local rotpY = 0 local rotpZ = getPlayerRotation(player) local rotvX,rotvY,rotvZ = getVehicleRotation(vehicle) local t = math.rad(rotvX) local p = math.rad(rotvY) local f = math.rad(rotvZ) local ct = math.cos(t) local st = math.sin(t) local cp = math.cos(p) local sp = math.sin(p) local cf = math.cos(f) local sf = math.sin(f) local z = ct*cp*sz + (sf*st*cp + cf*sp)*sx + (-cf*st*cp + sf*sp)*sy local x = -ct*sp*sz + (-sf*st*sp + cf*cp)*sx + (cf*st*sp + sf*cp)*sy local y = st*sz - sf*ct*sx + cf*ct*sy local rotX = rotpX - rotvX local rotY = rotpY - rotvY local rotZ = rotpZ - rotvZ local slot = getPlayerWeaponSlot(player) --outputDebugString("gluing ".. getPlayerName(player) .." to " .. getVehicleName(vehicle) .. "(offset: "..tostring(x)..","..tostring(y)..","..tostring(z).."; rotation:"..tostring(rotX)..","..tostring(rotY)..","..tostring(rotZ)..")") triggerServerEvent("gluePlayer", player, slot, vehicle, x, y, z, rotX, rotY, rotZ) unbindKey("x","down",glue) bindKey("x","down",unglue) bindKey("jump","down",unglue) end end end addCommandHandler("glue",glue) function unglue () local player = getLocalPlayer() triggerServerEvent("ungluePlayer", player) unbindKey("jump","down",unglue) unbindKey("x","down",unglue) bindKey("x","down",glue) end addCommandHandler("unglue",unglue) bindKey("x","down",glue) Server: function gluePlayer(slot, vehicle, x, y, z, rotX, rotY, rotZ) attachElementToElement(source, vehicle, x, y, z, rotX, rotY, rotZ) setPlayerWeaponSlot(source, slot) end addEvent("gluePlayer",true) addEventHandler("gluePlayer",getRootElement(),gluePlayer) function ungluePlayer() detachElementFromElement(source) end addEvent("ungluePlayer",true) addEventHandler("ungluePlayer",getRootElement(),ungluePlayer)
×
×
  • Create New...