Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. There is a function for it. bool resetTimer ( timer theTimer )
  2. He said it works i thought it won't because it's for tables so anyway it should be string.len.
  3. Hmm, i am not sure but i think that won't work here: string.len('gta')
  4. Oh i forgot addEventHandler('onResourceStart', resourceRoot, function() for i,v in ipairs(getElementsByType('player')) do setElementData(v, 'canPlay', true) end end ) addEventHandler('onPlayerJoin', root, function() setElementData(source, 'canPlay', true) end )
  5. No, he want it to spawn at creation position.
  6. I have like 1000 txd file or even more i had to make a meta more than 1000 line to put them And now i have to load and import them OMG! How come on i am a human and i want to do it so bad and i have to copy it's name and find it in IDE !! Is there like a model generator or engineLoadTxd and engineImportTXD generator. Thanks in advance.
  7. What the hell is this here: function taskagitmakas ( player, command, tkm ) if getElementData(player, 'canPlay') then local rand = math.random(0,2) local playing = nil if tkm == 'rock' then playing = 'rock' elseif tkm == 'paper' then playing = 'paper' elseif tkm == 'scissors' then playing = 'scissors' end if rand == 0 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock !" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player) ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played "..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end end setElementData(player, 'canPlay', false) setTimer(setElementData, 60000, 1, player, 'canPlay', true) else outputChatBox('You have to wait 1 minute before you play again', player) end addCommandHandler ( "tkm", taskagitmakas ) Why is the onPlayerChat thing?
  8. Ok so you want the player to use it once then a 60 seconds timer start ok do this use setElementData --at the start of your command do this if getElementData(player, 'canPlay') then --the command code --at the end of the command setElementData(player, 'canPlay', false) setTimer(setElementData, 60000, 1, player, 'canPlay', true)
  9. There are more than one way to do it maybe this function taskagitmakas ( player, command, tkm ) local rand = math.random(0,2) local playing = nil if tkm == 'rock' then local playing = 'rock' elseif tkm == 'paper' then local playing = 'paper' elseif tkm == 'scissors' then local playing = 'scissors' end if rand == 0 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." has played#00cc00"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock !" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player) ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end removeCommandHandler( "tkm", taskagitmakas ) setTimer(addCommandHandler, 60000, 1, taskagitmakas ) end addCommandHandler ( "tkm", taskagitmakas )
  10. local rand = math.random(0,2) local playing = nil if tkm == 'rock' then playing = 'rock' elseif tkm == 'paper' then playing = 'paper' elseif tkm == 'scissors' then playing = 'scissors' end
  11. Dude why did you double post and the same message function taskagitmakas ( player, command, tkm ) local rand = math.random(0,2) local playing = nil if tkm == 'rock' then local playing = 'rock' elseif tkm == 'paper' then local playing = 'paper' elseif tkm == 'scissors' then local playing = 'scissors' end if rand == 0 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." has played#00cc00"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock !" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player) ,getRootElement(),0,255,0,true) end if rand == 0 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played rock!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 1 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played paper!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw!" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'rock' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner"..getPlayerName(player), getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'scissors' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Draw" ,getRootElement(),0,255,0,true) end if rand == 2 and tkm == 'paper' then outputChatBox("Rock,Paper,Scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#cc0000"..getPlayerName(player).." #00cc00has played"..playing.."!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00CPU played scissors!" ,getRootElement(),0,255,0,true) outputChatBox("#00cc00Winner CPU!" ,getRootElement(),0,255,0,true) end end addCommandHandler ( "tkm", taskagitmakas )
  12. here u defined playing as nil local playing = nil and it wont change because your if is wrong if tkm == rock then local playing = rock elseif tkm == paper then local playing = paper elseif tkm == scissors then local playing = scissors end when a player types something its a string so it should be if tkm == 'rock' then local playing = 'rock' elseif tkm == 'paper' then local playing = 'paper' elseif tkm == 'scissors' then local playing = 'scissors' end
  13. Post the error, and post the line.
  14. Ok, then are you using a map file or... any way do this bool setVehicleRespawnPosition ( vehicle theVehicle, float x, float y, float z, [float rx, float ry, float rz ] ) use it onresourcestart and set the respawn position to the creation position.
  15. respawnVehicle(ewvehicle) respawn vehicle will spawn it in the creation position
  16. I use ' ' so When i wanted to use a word like "can't" i had to escape it like this 'can\'t' so that's it? that's the escape? and in your example above testName = '[FP]FatPony' newName = string.gsub(testName, '\[FP\]', '') -- and the name now is: atony Am i right?
  17. 1 question why you use % before each [ or | or ( else i understand. thanks btw i learned something new
  18. So i can use this if string.find('mtaft', '[mta]', 0) will it find mta ?
  19. I can't understand any thing of this: newn:find("[%[%(%|][fF][pP][%]%)%|]*") newPlayerName = playerName:gsub("[%[%(%|][fF][pP][%]%)%|]*", "") i just don't understand those patterns.
  20. Exactly, oynanan is not defined.
  21. where is 'oynanan' defined and post the errors
  22. function taskagitmakas ( player, commandName, tkm ) local rand = math.random(0,2) local oynanan = bilinmeyen if tkm == tas then local oynanan = tas elseif tkm == kagit then local oynanan = kagit elseif tkm == makas then local oynanan = makas end
  23. local playerName = getPlayerName(player) newPlayerName = playerName:gsub('[FP]', '') setPlayerName(player, newPlayerName)
×
×
  • Create New...