Guest User

Untitled

a guest
Oct 5th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3.  
  4. // Basic way of making a stats command, for kills and deaths. To the same to Score, Name etc
  5.  
  6. // Create your variables
  7. new
  8. Player_Kills[MAX_PLAYERS],
  9. Player_Deaths[MAX_PLAYERS]
  10. ;
  11. // Or you can use the Enum way, but best to learn this way first
  12.  
  13.  
  14. public OnPlayerDeath(playerid, killerid, reason)
  15. {
  16. // Then assign your variables to OnPlayerDeath, which means when the players dies or kills
  17. Player_Kills[killerid] ++; // Add +1 kill to the killer id
  18.  
  19. Player_Deaths[playerid] ++; // Add +1 death to the player that dies
  20. return 1;
  21. }
  22.  
  23.  
  24. COMMAND:stats(playerid, params[])
  25. {
  26. new string[128]; // This is your string, to store characters
  27.  
  28. // Assign your variables to the stats string
  29. format(string, sizeof(string), "%d %d", Player_Kills[playerid], Player_Deaths[playerid]); // %d means number cause the variables are numbers
  30.  
  31. SendClientMessage(playerid, -1, string); //Send the string as client message, or change this to dialog, what ever you like
  32. return 1;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment