Advertisement
errur

Player stuff

Apr 21st, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. class PlayerC
  2. {      
  3.     score = null;  
  4.    
  5.     constructor()
  6.     {      
  7.         score = 0;     
  8.     }
  9.    
  10.     function AddScorePlayer(what)
  11.     {
  12.         //Check to prevent our score from going into negative since we can AddScore(-50) for example
  13.         if(score + what >= 0)
  14.         {
  15.             score += what;
  16.         }
  17.     }
  18.    
  19. }
  20.  
  21. ::players <- {}
  22.  
  23.  
  24. function PlayerStart()
  25. {
  26.     if(activator.GetTeam() == 3)
  27.     {
  28.         p = activator;
  29.        
  30.         players[p] <- Playerc();
  31.        
  32.         p.SetModel("models/player/custom_player/kuristaja/cso2/sas/sas.mdl");
  33.         p.__KeyValueFromString("targetname", "player");    
  34.  
  35.         EntFire( "playerspeed", "ModifySpeed", "1.0", 0.0, p);
  36.         EntFire( "ammo_give", "GiveAmmo","", 0.0, p);
  37.         EntFire( "equip_player","Use","",0.0, p);
  38.  
  39.         p.SetMaxHealth(400);
  40.         p.SetHealth(200);
  41.  
  42.         EntFire("text","SetText","SCORE : "+score,0.0,p);
  43.         EntFire("text_dash","Display","",0.0,p);
  44.         EntFire("text","Display","",0.0,p);
  45.     }
  46. }
  47.  
  48. function AddScore(who, what)
  49. {
  50.     players[who].AddScorePlayer(what);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement