Guest User

Untitled

a guest
Dec 29th, 2013
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. //== na vrh
  2. #define STARTING_GLAD 100
  3. #define STARTING_WC 100
  4. forward GladWCCheck();
  5. new PlayerText:Texttdraw4[MAX_PLAYERS];
  6. //
  7.  
  8. // pod
  9. public OnPlayerConnect(playerid)
  10. {
  11. SetPVarInt(playerid, "glad", STARTING_GLAD); // Govori igraecvu glad
  12. SetPVarInt(playerid, "wc", STARTING_WC); // Govori igracev wc
  13. SetPVarInt(playerid, "showinggw", 0); // Govori dali prikazuje text za glad i wc
  14.  
  15. Texttdraw4[playerid] = CreatePlayerTextDraw(playerid,499.000000, 430.000000, "GLAD: 100% W~C: 100%");
  16. PlayerTextDrawLetterSize(playerid,Texttdraw4[playerid],0.279999, 1.199999);
  17. PlayerTextDrawBackgroundColor(playerid,Texttdraw4[playerid],255);
  18. PlayerTextDrawColor(playerid,Texttdraw4[playerid],-500552961);
  19. PlayerTextDrawFont(playerid,Texttdraw4[playerid],2);
  20. PlayerTextDrawSetOutline(playerid,Texttdraw4[playerid],0);
  21. PlayerTextDrawSetProportional(playerid,Texttdraw4[playerid],1);
  22. PlayerTextDrawSetShadow(playerid,Texttdraw4[playerid],0);
  23. return 1;
  24. }
  25. // pod
  26. public OnPlayerSpawn(playerid)
  27. {
  28. if(GetPVarInt(playerid, "showinggw") == 0) {
  29. SetPVarInt(playerid, "showinggw", 1);
  30. UpdateGladWCText(playerid);
  31. PlayerTextDrawShow(playerid, Texttdraw4[playerid]); }
  32. return 1;
  33. }
  34. // pod
  35. public OnGameModeInit()
  36. {
  37. SetTimer("GladWCCheck", 60000, 1); // za svaku minutu
  38. return 1;
  39. }
  40. // negdje na kraj
  41. stock GiveGlad(playerid, glad) {
  42. SetPVarInt(playerid, "glad", GetPVarInt(playerid, "glad")+glad);
  43. if(GetPVarInt(playerid, "glad") > 100) { SetPVarInt(playerid, "glad", 100); }
  44. return 1; }
  45.  
  46. stock GiveWC(playerid, wc) {
  47. SetPVarInt(playerid, "wc", GetPVarInt(playerid, "wc")+wc);
  48. if(GetPVarInt(playerid, "wc") > 100) { SetPVarInt(playerid, "wc", 100); }
  49. return 1; }
  50.  
  51. public GladWCCheck() {
  52. for(new i=0;i<MAX_PLAYERS;i++) {
  53. if(IsPlayerConnected(i)) {
  54. new Float:phealth; GetPlayerHealth(i, phealth);
  55. GiveGlad(i, -1);
  56. if(GetPVarInt(i, "glad") < 0) { SetPVarInt(i, "glad", 0); SetPlayerHealth(i, phealth-1); }
  57. GiveWC(i, -1);
  58. if(GetPVarInt(i, "wc") < 0) { SetPVarInt(i, "wc", 0); SetPlayerHealth(i, phealth-1); }
  59. UpdateGladWCText(i); } }
  60. return 1; }
  61.  
  62. stock UpdateGladWCText(playerid) {
  63. if(!IsPlayerConnected(playerid)) { return 1; }
  64. new str[128];
  65. format(str, sizeof(str), "GLAD: %d ~w~WC:~w~ %d", GetPVarInt(playerid, "glad"), GetPVarInt(playerid, "wc"));
  66. PlayerTextDrawSetString(playerid, Texttdraw4[playerid], str);
  67. return 1; }
Advertisement
Add Comment
Please, Sign In to add comment