-- Table to store player classes (example) PlayerClasses = {} -- Function to handle the /fireball command function HandleFireballCommand(Split, Player) -- Check if the player is a Mage if PlayerClasses[Player:GetUUID()] ~= "Mage" then Player:SendMessage(cChatColor.Red .. "Only Mages can use Fireball!") return true end -- Get player's position and look direction local Pos = Player:GetPosition() local LookVector = Player:GetLookVector() local World = Player:GetWorld() -- Check if the world is valid if World then -- Spawn a fireball (cFireChargeEntity) in the direction the player is looking local Fireball = cFireChargeEntity(Pos.x, Pos.y + 1.5, Pos.z, LookVector.x * 5, LookVector.y * 5, LookVector.z * 5) World:SpawnEntity(Fireball) Player:SendMessage(cChatColor.LightPurple .. "You cast a Fireball!") else Player:SendMessage(cChatColor.Red .. "Error: World is not valid!") end return true end -- Hook to set up player classes on join (for testing purposes) function OnPlayerJoin(Player) PlayerClasses[Player:GetUUID()] = "Mage" -- Assign all players the Mage class temporarily Player:SendMessage(cChatColor.LightPurple .. "You are a Mage and can use /fireball!") end -- Initialization function function Initialize(Plugin) Plugin:SetName("MageFireball") Plugin:SetVersion(1) -- Register the /fireball command cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_JOIN, OnPlayerJoin) cPluginManager:BindCommand("/fireball", "mage.fireball", HandleFireballCommand, " - Cast a fireball (Mage only)") LOG("Initialized MageFireball plugin!") return true end