Advertisement
Guest User

First pawn script by naoufal

a guest
Feb 3rd, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. // The teams
  4. #define TEAM_BLUE 1
  5.  
  6. #define TEAM_GREEN 2
  7.  
  8. // Colours of the teams
  9. #define TEAM_BLUE_COLOUR 0x0000BBAA // Team Blue
  10.  
  11. #define TEAM_GREEN_COLOUR 0x33AA33AA // Team Green
  12.  
  13. // Can get in which team the player is
  14. new gTeam[MAX_PLAYERS];
  15.  
  16. main()
  17. {
  18. print("\n----------------------------------");
  19. print("Team script made by Naoufal");
  20. print("----------------------------------\n");
  21. }
  22.  
  23. public OnGameModeInit()
  24. {
  25. SetGameModeText("Teams");
  26. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); // blue team
  27. AddPlayerClass(1, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); // green team
  28. return 1;
  29. }
  30.  
  31. public OnPlayerRequestClass(playerid, classid)
  32. {
  33. SetPlayerTeamFromClass(playerid, classid);
  34. return 1;
  35. }
  36.  
  37. public OnPlayerSpawn(playerid)
  38. {
  39. SetPlayerToTeamColour(playerid);
  40. return 1;
  41. }
  42.  
  43. SetPlayerTeamFromClass(playerid, classid)
  44. {
  45. if(classid == 0)
  46. {
  47. gTeam[playerid] = TEAM_BLUE; // This is using the defines of Team Blue
  48. }
  49. else if(classid == 1)
  50. {
  51. gTeam[playerid] = TEAM_GREEN; // This is using the defines of Team Green
  52. }
  53.  
  54. }
  55.  
  56. SetPlayerToTeamColour(playerid)
  57. {
  58. if(gTeam[playerid] == TEAM_BLUE)
  59. {
  60. SetPlayerColor(playerid,TEAM_BLUE_COLOUR); // Color of the player in team green
  61. }
  62. else if(gTeam[playerid] == TEAM_GREEN)
  63. {
  64. SetPlayerColor(playerid,TEAM_GREEN_COLOUR); // Color of the player in team green
  65. }
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement