• Cider - Adding Weps to Firefighter
    11 replies, posted
Hello! Need help so badly to get firefighter on my server to spawn with my fire extinguisher. It is called cider_extinguisher And also, i have a medic swep, how to add tha to para medic? Link to sv_ini: [url]http://www.mediafire.com/?sharekey=ad0ba7ae70b8e355e62ea590dc5e5dbbe04e75f6e8ebb871[/url] [lua]--[[ Name: "sv_init.lua". Product: "Cider (Roleplay)". --]] local PLUGIN = {}; -- Create a variable to store the plugin for the shared file. PLUGIN_SHARED = PLUGIN; -- Include the shared file and add it to the client download list. include("sh_init.lua"); AddCSLuaFile("sh_init.lua"); -- Say a message as a request. function PLUGIN.sayRequest(player, text) for k, v in pairs( g_Player.GetAll() ) do if (v:Team() == TEAM_COMBINEOFFICER or v:Team() == TEAM_COMBINEOVERWATCH or v:Team() == TEAM_CITYADMINISTRATOR) then cider.chatBox.add(v, player, "request", text); end; end; end; -- Say a message as a broadcast. function PLUGIN.sayBroadcast(player, text) cider.chatBox.add(nil, player, "broadcast", text); end; -- Called when a player has initialized. function PLUGIN.playerInitialized(player) if (player.cider._Donator > 0) then local expire = math.max(player.cider._Donator - os.time(), 0); -- Check if the expire time is greater than 0. if (expire > 0) then local days = math.floor( ( (expire / 60) / 60 ) / 24 ); local hours = string.format("%02.f", math.floor(expire / 3600)); local minutes = string.format("%02.f", math.floor(expire / 60 - (hours * 60))); local seconds = string.format("%02.f", math.floor(expire - hours * 3600 - minutes * 60)); -- Give them their access. cider.player.giveAccess(player, "tpew"); -- Check if we still have at least 1 day. if (days > 0) then cider.player.printMessage(player, "Your Donator status expires in "..days.." day(s)."); else cider.player.printMessage(player, "Your Donator status expires in "..hours.." hour(s) "..minutes.." minute(s) and "..seconds.." second(s)."); end; -- Set some Donator only player variables. player._SpawnTime = cider.configuration["Spawn Time"] / 2; player._ArrestTime = cider.configuration["Arrest Time"] / 2; player._KnockOutTime = cider.configuration["Knock Out Time"] / 2; else player.cider._Donator = 0; -- Take away their access and save their data. cider.player.takeAccess(player, "tpew"); cider.player.saveData(player); -- Notify the player about how their Donator status has expired. cider.player.notify(player, "Your Donator status has expired, donate more.?", 1); end; end; -- Make the player a Citizen to begin with. cider.team.make(player, TEAM_CITIZEN); end; -- Add the hook. cider.hook.add("PlayerInitialized", PLUGIN.playerInitialized); -- Called when a player's radio recipients should be adjusted. function PLUGIN.playerAdjustRadioRecipients(player, text, recipients) if (player:Team() == TEAM_COMBINEOFFICER or player:Team() == TEAM_COMBINEOVERWATCH or player:Team() == TEAM_CITYADMINISTRATOR) then for k, v in pairs(recipients) do recipients[k] = nil; end; -- Add the entries into the recipients table. table.Add( recipients, team.GetPlayers(TEAM_COMBINEOFFICER) ); table.Add( recipients, team.GetPlayers(TEAM_COMBINEOVERWATCH) ); table.Add( recipients, team.GetPlayers(TEAM_CITYADMINISTRATOR) ); elseif (player:Team() == TEAM_REBELLEADER or player:Team() == TEAM_REBELDEALER or player:Team() == TEAM_REBEL) then for k, v in pairs(recipients) do recipients[k] = nil; end; -- Add the entries into the recipients table. table.Add( recipients, team.GetPlayers(TEAM_REBELLEADER) ); table.Add( recipients, team.GetPlayers(TEAM_REBELDEALER) ); table.Add( recipients, team.GetPlayers(TEAM_REBEL) ); end; end; -- Add the hook. cider.hook.add("PlayerAdjustRadioRecipients", PLUGIN.playerAdjustRadioRecipients); -- Called when a player attempts to use a tool. function PLUGIN.canTool(player, trace, tool) if ( !cider.player.hasAccess(player, "w") ) then if (string.sub(tool, 1, 5) == "wire_") then player:ConCommand("gmod_toolmode \"\"\n"); -- Return false because we cannot use the tool. return false; end; end; end; -- Add the hook. cider.hook.add("CanTool", PLUGIN.canTool); -- Called every frame. function PLUGIN.think() if (PLUGIN.lockdown and team.NumPlayers(TEAM_CITYADMINISTRATOR) == 0) then PLUGIN.lockdown = false; -- Set a global integer so that the client can get whether there is a lockdown. SetGlobalInt("cider_Lockdown", 0); end; end; -- Add the hook. cider.hook.add("Think", PLUGIN.think); -- Called every second that a player is on the server. function PLUGIN.playerSecond(player) if ( !cider.player.hasAccess(player, "w") ) then local tool = player:GetInfo("gmod_toolmode"); -- Check if the tool they are using is a Wire tool. if (string.sub(tool, 1, 5) == "wire_") then player:ConCommand("gmod_toolmode \"\"\n"); end; end; end; -- Add the hook. cider.hook.add("PlayerSecond", PLUGIN.playerSecond); -- Called when a player should be given their weapons. function PLUGIN.playerLoadout(player) player._SpawnWeapons = {}; -- Check the player's team. if (player:Team() == TEAM_REBELLEADER) then player:Give("cider_breakout"); player:Give("cider_lockpick"); elseif (player:Team() == TEAM_COMBINEOFFICER or player:Team() == TEAM_COMBINEOVERWATCH) then player:Give("weapon_stunstick"); player:Give("cider_glock18"); player:Give("cider_mp5"); player:Give("cider_arrest"); player:Give("cider_unarrest"); player:Give("cider_knockout"); player:Give("cider_wakeup"); player:Give("cider_ram"); player:GiveAmmo(256, "pistol"); player:GiveAmmo(512, "smg1"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_glock18"] = true; player._SpawnWeapons["cider_mp5"] = true; -- Check if the player is the Combine Overwatch. if (player:Team() == TEAM_COMBINEOVERWATCH) then player:Give("cider_m3super90"); player:Give("weapon_frag"); player:GiveAmmo(2, "grenade"); player:GiveAmmo(128, "buckshot"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_m3super90"] = true; end; elseif (player:Team() == TEAM_CITYADMINISTRATOR) then player:Give("cider_ram"); player:Give("cider_fiveseven"); player:GiveAmmo(256, "pistol"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_fiveseven"] = true; end; -- Select the hands weapon. player:SelectWeapon("cider_hands"); end; -- Called when a player attempts to holster a weapon. function PLUGIN.playerCanHolster(player, weapon, silent) if ( player._SpawnWeapons[weapon] ) then if (!silent) then cider.player.notify(player, "You cannot holster this weapon!", 1); end; -- Return false because they cannot holster this weapon. return false; end; end; -- Add the hook. cider.hook.add("PlayerCanHolster", PLUGIN.playerCanHolster); -- Called when a player attempts to use a door. function PLUGIN.playerCanUseDoor(player, door) if ( !ValidEntity(door._Owner) ) then if (player:Team() != TEAM_COMBINEOFFICER and player:Team() != TEAM_COMBINEOVERWATCH and player:Team() != TEAM_CITYADMINISTRATOR) then return false; end; end; end; -- Add the hook. cider.hook.add("PlayerCanUseDoor", PLUGIN.playerCanUseDoor); -- Called when a player attempts to use an item. function PLUGIN.playerCanUseItem(player, item, silent) if ( player._SpawnWeapons[item] ) then if (!silent) then cider.player.notify(player, "You cannot use this weapon!", 1); end; -- Return false because they cannot holster this weapon. return false; end; end; -- Add the hook. cider.hook.add("PlayerCanUseItem", PLUGIN.playerCanUseItem); -- Called when a player's salary should be adjusted. function PLUGIN.playerAdjustSalary(player) if (player.cider._Donator > 0) then player._Salary = player._Salary * 2; end; end; -- Add the hook. cider.hook.add("PlayerAdjustSalary", PLUGIN.playerAdjustSalary); -
Lua tags please? [noparse][lua][/lua][/noparse]
[QUOTE=Jamie932;17534802]Lua tags please? [noparse][lua][/lua][/noparse][/QUOTE] What u mean by that? I am totally new to scripting/lua ;P
Do you really expect us to read all this? All put your code around the tags Jamie stated!
[QUOTE=commander204;17535643]Do you really expect us to read all this? All put your code around the tags Jamie stated![/QUOTE] I dont understand a shit what u mean by that? Totally new dude..
Go to edit your post, and then at the begining of all that code, put [noparse][lua][/noparse] and then at the bottom of all that code, put [noparse][/lua][/noparse].
Ok, done it!:)
[QUOTE=Jamie932;17535787]Go to edit your post, and then at the begining of all that code, put [noparse][lua][/noparse] and then at the bottom of all that code, put [noparse][/lua][/noparse].[/QUOTE] Now help me?:D
[QUOTE=MariusAasgaard;17540212]Now help me?:D[/QUOTE] Anyone?
[QUOTE=Jamie932;17535787]Go to edit your post, and then at the begining of all that code, put [noparse][lua][/noparse] and then at the bottom of all that code, put [noparse][/lua][/noparse].[/QUOTE] Jamie, will you now fix? its got the [LUA] thingy :D
[QUOTE=MariusAasgaard;17611706]Jamie, will you now fix? its got the [LUA] thingy :D[/QUOTE] Sorry, I know nothing about cider. I was just asking you if you could make the code readable for others.
Heres how to: [lua] -- Called when a player should be given their weapons. function PLUGIN.playerLoadout(player) player._SpawnWeapons = {}; -- Check the player's team. if (player:Team() == TEAM_FIREFIGHTER) then player:Give('cider_extinguisher'); player._SpawnWeapons['cider_extinguisher'] = true; end; if (player:Team() == TEAM_REBELLEADER) then player:Give("cider_breakout"); player:Give("cider_lockpick"); elseif (player:Team() == TEAM_COMBINEOFFICER or player:Team() == TEAM_COMBINEOVERWATCH) then player:Give("weapon_stunstick"); player:Give("cider_glock18"); player:Give("cider_mp5"); player:Give("cider_arrest"); player:Give("cider_unarrest"); player:Give("cider_knockout"); player:Give("cider_wakeup"); player:Give("cider_ram"); player:GiveAmmo(256, "pistol"); player:GiveAmmo(512, "smg1"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_glock18"] = true; player._SpawnWeapons["cider_mp5"] = true; -- Check if the player is the Combine Overwatch. if (player:Team() == TEAM_COMBINEOVERWATCH) then player:Give("cider_m3super90"); player:Give("weapon_frag"); player:GiveAmmo(2, "grenade"); player:GiveAmmo(128, "buckshot"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_m3super90"] = true; end; elseif (player:Team() == TEAM_CITYADMINISTRATOR) then player:Give("cider_ram"); player:Give("cider_fiveseven"); player:GiveAmmo(256, "pistol"); -- Add to the player's spawn weapons. player._SpawnWeapons["cider_fiveseven"] = true; end; -- Select the hands weapon. player:SelectWeapon("cider_hands"); end; [/lua] Look closer to it: [lua] if (player:Team() == TEAM_FIREFIGHTER) then player:Give('cider_extinguisher'); player._SpawnWeapons['cider_extinguisher'] = true; end; [/lua] Add that script, like i did and it should work, check [lua]TEAM_FIREFIGTHER[/lua] I don't know what your TEAM name is! #Goodluck!
Sorry, you need to Log In to post a reply to this thread.