Author Topic: Some Gamemode Coding qeustions  (Read 415 times)

0 Members and 1 Guest are viewing this topic.

Offline StartedBullet

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-1
    • View Profile
Some Gamemode Coding qeustions
« on: June 03, 2010, 01:40:46 AM »
Hello, i have a few coding qeustions. I will start a new post should i have more.

here is 1, I have a round restart etc. func, but i want to make choosing the winner be choosing the team

_________________________________________
timer.Create("my_timer", 300, 0, function()
for k,v in pairs( team.GetPlayers(1) ) do
v:SetFrags( 0 ) // Reset their frags for next round
for k,v in pairs( team.GetPlayers(2) ) do
v:SetFrags( 0 ) // Reset their frags for next round
player:Spawn() // Timer code here

local winner
local topscore = 0

for k,v in pairs( player.GetAll() ) do
winner = v
topscore = v:Frags()
ply:ChatPrint("the winner is " .. winner:Nick())
return winner
end
end
end
end )
__________________________________________   

And This is not showing when i press f2, no idea why, how do i make it

__________________________________________

function showshiz( ply ) -- This hook is called everytime F1 is pressed.
    ply.concommand( "sb_teams" )
end
hook.Add("ShowTeam", showshiz)

__________________________________________

One last thing, i want to run the function sb_teams on this, wgich command should i use to run it?
___________________________________________

function GM:PlayerSpawn( ply )  //What happens when the player spawns
     self.BaseClass:PlayerSpawn( ply )
    ply:SetGravity( 0.75 ) 
    ply:SetMaxHealth( 100, true ) 
 
    ply:SetWalkSpeed( 325 ) 
   ply:SetRunSpeed( 325 )
    ply:StripWeapons()
   ply:Give ( "weapon_fiveseven" )
   
end

____________________________________________