Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Lua Plugin Help!
Lua Plugin Help! [message #330438] Tue, 13 May 2008 18:21 Go to previous message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma:
Colonel
Hello, i was unable to make this script work on lua plguin.
Could you guys help me please...
function FindWords(Text)
   -- This Function Made Soley By PsuFan
   -- Please Read The Following Steps/Information Carefully

   -- This function finds all the words in the message you send it
   -- FirstW, SecondW, SecondPlus, ThirdW, ThirdPlus, and FourthW are whats returned

   -- Installation:
   --    1: Copy this sub into your luaplugin.lua at the bottom of the file
   --    2: Add this line to the top of OnChat function >  FindWords(Message)
   -- Thats it! You can now use FirstW, SecondW, etc in your OnChat function.

   -- This function is great for commands like !ban psufan because he sucks
   -- !ban <name> <reason>
   -- FirstW would equal "!ban"
   -- SecondW would equal "psufan" or the <name>
   -- Then the reason would be ThirdPlus ("because he sucks") or the <reason>

   -- Key:
   --   FirstW     = First Word
   --   SecondW    = Second Word
   --   SecondPlus = Second Word Till End   
   --   ThirdW     = Third Word
   --    ThirdPlus  = Third Word Till End
   --   FourthW    = Fourth Word


   -- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
   -- Please Do Not Edit Beyond This Point, If this function isnt working properly for you,
   -- contact PsuFan to assist you. This code is to complicated for you to fix anyway.
   -- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
   
   Found = string.find(Text, " ")
   if Found ~= nil then
      FirstW = string.sub(Text, 0, Found - 1)
      SecondW = string.sub(Text, Found + 1)
      SecondPlus = SecondW

      Found = string.find(SecondW, " ")
      if Found ~= nil then
         ThirdW = string.sub(SecondW, Found + 1)
         SecondW = string.sub(SecondW, 0, Found - 1)
         ThirdPlus = ThirdW

         Found = string.find(ThirdW, " ")
         if Found ~= nil then
            FourthW = string.sub(ThirdW, Found + 1)
            ThirdW = string.sub(ThirdW, 0, Found - 1)

            Found = string.find(FourthW, " ")
            if Found ~= nil then
               FourthW = string.sub(FourthW, 0, Found - 1)
            end
         else
            FourthW = ""
         end
      else
         ThirdW = ""
         ThirdPlus = ""
         FourthW = ""
      end
   else
      FirstW = Text
      SecondW = ""
      SecondPlus = ""
      ThirdW = ""
      ThirdPlus = ""
      FourthW = ""
   end
end


Sorry that i posted the lua related topic here. People in forums.dcom.productions.net arent visiting that forums alot so i wanted to get some help here.


This account is no longer being active.

[Updated on: Tue, 13 May 2008 18:21]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can someone edit Hourglass slightly for me
Next Topic: were i get firstpersone view gun thing like
Goto Forum:
  


Current Time: Sat Jan 11 01:54:02 MST 2025

Total time taken to generate the page: 0.01356 seconds