Jump to content

pejczi

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by pejczi

  1. Hello, I've got some problem with tables - i add the serial to the table and when i check if it exists there, it outputs that nope.. What's wrong over here? serials = { } function addToTable (thePlayer,command) local serial = getPlayerSerial(thePlayer) if serial then table.insert(serials,serial) outputChatBox ( " #FF0000Serial added successfuly to the table", root, 255, 255, 255, true ) end end addCommandHandler ( "addtable" , addToTable ) function checkPlayer(thePlayer, command) if serials[serial] then outputChatBox ( " #FF0000There are serials in the table", root, 255, 255, 255, true ) else outputChatBox ( " #FF0000There are no serials in the table", root, 255, 255, 255, true ) end end addCommandHandler ( "checktable" , checkPlayer )
  2. Still ain't add the object. Debugger outputs nothing.
  3. but still dunno what should be the eventHandler for this function.
  4. Hey, Recently I found out function addVehicleSirens The problem is that it gives only siren sound from vehicle instead of object on the roof + sound addVehicleSirens(source,1,2,true,true,true,false) https://wiki.multitheftauto.com/wiki/AddVehicleSirens Maybe i wrote bad integers? Any ideas for lights on the roof?
  5. It's defined function - same as "getPlayerFromNamePart" in example below : function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end u can use it later in next functions . Just u have to define what's "outputColoredMessage".
  6. pejczi

    Unban all

    But why? I don't want to get any nick ;o
  7. pejczi

    Unban all

    Doesn't output any message when i'm logged in and table is clear, when i'm not logged in ,it outputs "No players to unban!". And still " outputChatBox ("All players has been successfully unbanned using Pejczi's script !" , source)" is in loop. bans = {} function unBanAll ( source, command ) if ( hasObjectPermissionTo ( source , "function.removeBan", true ) ) then local bans = getBans() for i,d in ipairs ( bans ) do removeBan(d) if (removeBan(d) ) then outputChatBox ("All players has been successfully unbanned using Pejczi's script !" , source) else outputChatBox ( " You have no permission to unban all" , source ) end end else table.getn ( bans ) if #bans == 0 then outputChatBox ("No players to unban!" , source) end end end addCommandHandler ("unbanall", unBanAll) Added table, but still ain't work.
  8. pejczi

    Unban all

    function unBanAll ( source, command ) if ( hasObjectPermissionTo ( source , "function.removeBan", false ) ) then local bans = getBans() for i,d in ipairs ( bans ) do local nick = getBanNick (d) if (removeBan(d) ) then outputChatBox ("All players has been successfully unbanned using Pejczi's script !" , source) else outPutChatBox ( " You have no permission to unban all" , source ) end end table.getn ( bans ) if #bans == 0 then outputChatBox ("No players to unban!") end end end addCommandHandler ("unbanall", unBanAll) It shows as many "All players has been successfully unbanned using Pejczi's script " outputs, as there are bans , cause it's in the loop - the problem is i have no idea how to put it out of the loop. Second problem is it doesn't show "You have no permission to unban all" - it shows correctly "No players to unban" when table is empty. Any ideas ?
  9. Jesus, I forgot to put eventhandler - when I put just "onRaceStateChanging", it has blown my car before counting - when i put if if (state == "Running") , then it doesn't blow me. ////No help needed, i found out a problem. I had to put addEvent
  10. try using destroyElement But it's for race gamemode ; if the vehicle will get destroyed, then whole gamemode is getting bugged.
  11. Ok, last trouble got elminated, now i've got other - the vehicle of spectator doesn't get blown. function killTeam () local theTeam = getTeamFromName ( "SPECTATORS" ) if ( theTeam ) then local players = getPlayersInTeam ( theTeam ) for key, player in ipairs ( players ) do local theVehicle = getPedOccupiedVehicle ( player ) if ( theVehicle ) then blowVehicle ( theVehicle ) end end end end I know, that the argument of blowVehicle is invalid, but i have no idea which do I have to put in.
  12. works, thanks ! But i found out one trouble, i have to type "/spec pejczi" twice, otherwise it won't move me to the team
  13. Ok, i spotted the problem ; maximal character length of nick is 21 . function deleteTag ( source, command, thePlayer ) local spec = getPlayerFromNamePart ( thePlayer ) if ( spec ) then if getElementType ( spec ) == "player" then local oldName = getPlayerName ( spec ) setPlayerName ( spec , string.gsub ( oldName , "[s]" , "" ) ) setPlayerTeam ( spec, nil ) outputChatBox ( "Player has been removed from SPEC team" , source ) end else outputChatBox ("Unable to remove player from SPEC team" , source ) end end addCommandHandler ( "nospec" , deleteTag ) Why it removes just S, instead of ?
  14. Yes, i'd like to. And it exists : https://wiki.multitheftauto.com/wiki/Ge ... omNamePart Ok, I've recognized that this function isn't predefined. Now it outputs "Player has been moved to SPEC team", but it doesn't add prefix. function getPlayerFromNamePart(name) if name then for i, player in ipairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), tostring(name):lower(), 1, true) then return player end end end return false end function setTag ( source, command, thePlayer ) local spec = getPlayerFromNamePart ( thePlayer ) if ( spec ) then if getElementType ( spec ) == "player" then local oldName = getPlayerName ( spec ) local newName = "SPEC-" .. oldName setPlayerName ( spec, newName ) outputChatBox ( "Player has been moved to SPEC team ", source ) end else outputChatBox ( "Unable to move player to SPEC team " , source ) end end addCommandHandler ( "spec" , setTag )
  15. Hey, I want to set player's nick prefics as SPEC- using one command - but debugger returns : "ERROR : spectators/spectator.lua:2: attempt to call global 'getPlayerFromNamePart' (a nil value)" The code is : function setTag ( source, command, thePlayer ) local spec = getPlayerFromNamePart ( thePlayer ) if ( spec ) then if getElementType ( spec ) == "player" then local oldName = getPlayerName ( spec ) local newName = "SPEC-" .. oldName setPlayerName ( spec, newName ) outputChatBox ( "Player has been moved to SPEC team ", source ) end else outputChatBox ( "Unable to move player to SPEC team " , source ) end end addCommandHandler ( "spec" , setTag ) Yours Faithfully, Pejczi.
  16. Yeah, now works Thanks, i didn't know how to make negation
  17. I want to give somebody my script ; and I don't want to let this script to be given somebody else. Ok, I've recognized that "getServerName" isn't event ; i added server sided event instead of this and defined one variable local resourceRoot = getResourceRootElement ( getThisResource ( ) ) function blockScript ( ) local serverName = getServerName ( ) if ( serverName == "GummyBear, false" ) then outputChatBox ( "BlablablaTest", 255, 255, 255, true ) end end addEventHandler ( "onResourceStart", resourceRoot, blockScript ) function moveVehicle ( vehicle ) local x, y, z = getElementPosition ( vehicle ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) function greetPlayer ( ) -- we store the player's name local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) -- and send him a greeting outputChatBox ( "Antibug car script #FF0000made by #00BFBFPejczi", getRootElement(), 255, 255, 255, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer )
  18. Ok, so i'll explain u what I wanted to do. I wanted to check if the event works - that's why i put outputchatbox instead of script block. What doesn't make any sense else? Do u have skype or any other messanger? It's hard to write there.
  19. Still doesn't work. At the beginning . Whole script looks : function blockScript ( ) local serverName = getServerName ( ) if ( serverName == "GummyBear, false" ) then outputChatBox ( "BlablablaTest", getRootElement(), 255, 255, 255, true ) end end addEventHandler ( "getServerName", root, blockScript ) function moveVehicle ( vehicle ) local x, y, z = getElementPosition ( vehicle ) if ( vehicle ) then setElementPosition ( vehicle, x, y, z - 100 ) end end addEvent ( "onPlayerRaceWasted", true ) addEventHandler ( "onPlayerRaceWasted" , getRootElement(), moveVehicle ) function greetPlayer ( ) -- we store the player's name local joinedPlayerName = getPlayerName ( source ) local serverName = getServerName( ) -- and send him a greeting outputChatBox ( "Antibug car script #FF0000made by #00BFBFPejczi", getRootElement(), 255, 255, 255, true ) end addEventHandler ( "onPlayerJoin", getRootElement(), greetPlayer ) Btw. u didn't define "root", did you?
  20. Still doesn't work, debug said "WARNING : [..] : Bad argument @ 'addEventHandler' [Expected element at argument 2 , got nil]
  21. Ok, I wanted to protect my script, so I decided to put server name "guard" function blockScript () local serverName = getServerName () if serverName = "Dream Friends CW/FW [email protected], false" then outputChatBox ( "BlablablaTest", getRootElement(), 255, 255, 255, true ) end end addEventHandler ("getServerName", blockScript) I added this to my script (just for look if event works) , but debugscript says that "then expected near '=' in line 21"
  22. Thanks very much, it finally works @BTW: Tell me, how did u find OnPlayerRaceWasted event?
  23. Aaah, sorry, didn't recognize, I was sleepy. It outputs : First part vehicle: userdata: 0x3b5b http://img833.imageshack.us/img833/3918/1wj.png As u can see from the screen.
×
×
  • Create New...