Guest User

Score system

a guest
Aug 23rd, 2010
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.86 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Text:Score[MAX_PLAYERS];
  4. forward Scores();
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     SetTimer("Scores", 1000, true);
  9.  
  10.     for(new i = 0; i < MAX_PLAYERS; i++)
  11.     {
  12.         Score[i] = TextDrawCreate(50.000000, 322.000000, " ");
  13.         TextDrawBackgroundColor(Score[i], 255);
  14.         TextDrawFont(Score[i], 1);
  15.         TextDrawLetterSize(Score[i], 0.549999, 1.300000);
  16.         TextDrawColor(Score[i], -16776961);
  17.         TextDrawSetOutline(Score[i], 0);
  18.         TextDrawSetProportional(Score[i], 1);
  19.         TextDrawSetShadow(Score[i], 1);
  20.     }
  21.     return 1;
  22. }
  23.  
  24. public OnPlayerConnect(playerid)
  25. {
  26.     TextDrawShowForPlayer(playerid, Score[playerid]);
  27.     return 1;
  28. }
  29.  
  30. public Scores()
  31. {
  32.     for(new i = 0; i < MAX_PLAYERS; i++)
  33.     {
  34.         if(IsPlayerConnected(i))
  35.         {
  36.             new string[48];
  37.             format(string, sizeof(string), "Score: %d", GetPlayerScore(i));
  38.             TextDrawSetString(Score[i], string);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment