Advertisement
Guest User

Untitled

a guest
Jan 25th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.46 KB | None | 0 0
  1. #define IsValidGroup(%0) (GroupeInfo[%0][Chef] == INVALID_PLAYER_ID)
  2. #define GetPlayerNameChefGroupe(%0) initialname[GroupeInfo[%0][Chef]]
  3. #define GetNumberMembersGroup(%0) (GroupeInfo[%0][Membres])
  4.  
  5. stock PlayerCreateGroup(playerid)
  6. {
  7.     new
  8.         groupeid;
  9.  
  10.     for(groupeid = MIN_GROUP; groupeid < MAX_GROUP; groupeid++)
  11.         if(IsValidGroup(groupeid)) break; // si il y a déjà un chef de groupe
  12.    
  13.     JoueurInfo[playerid][Groupe] = groupeid;
  14.     JoueurInfo[playerid][ChefGroupe] = true;
  15.     GroupeInfo[groupeid][Chef] = playerid;
  16.     GroupeInfo[groupeid][Membres]++;
  17.  
  18.     SCM(playerid, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Ton groupe a bien été créé. Utilise de nouveau /groupe pour inviter des joueurs.", groupeid);
  19.  
  20.     format(GroupeInfo[groupeid][Nom], sizeof(GroupeInfo[groupeid][Nom]), "Groupe de %s", initialname[playerid]);
  21.     GroupeDe[playerid] = Create3DTextLabel(GroupeInfo[groupeid][Nom], COLOR_GROUP, 30.0, 40.0, 10.0, 35.0, 0, 0);
  22.     Attach3DTextLabelToPlayer(GroupeDe[playerid], playerid, 0.0, 0.0, 0.7);
  23.    
  24.     return 1;
  25. }
  26.  
  27. stock PlayerRemoveGroup(playerid, groupeid)
  28. {
  29.     JoueurInfo[playerid][ChefGroupe] = false;
  30.     JoueurInfo[groupeid][Chef] = INVALID_PLAYER_ID;
  31.     JoueurInfo[groupeid][Membres] = 0;
  32.  
  33.     for(new i = 0; i < MAX_PLAYERS; i++)
  34.     {
  35.         if(!IsPlayerConnected(i)) continue;
  36.         if(!IsPlayerLogguer(i)) continue;
  37.         if(JoueurInfo[i][Groupe] != groupeid) continue;
  38.        
  39.         JoueurInfo[i][Groupe] = NO_TEAM;
  40.         SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le chef du groupe %s a supprimé le groupe.", initialname[playerid]);
  41.        
  42.         Delete3DTextLabel(GroupeDe[i]);
  43.     }
  44.    
  45.     return 1;
  46. }
  47.  
  48. stock PlayerJoinGroup(playerid, groupeid)
  49. {
  50.     JoueurInfo[playerid][Groupe] = groupeid;
  51.     GroupeInfo[groupeid][Membres]++;
  52.    
  53.     for(new i = 0; i < MAX_PLAYERS; i++)
  54.     {
  55.         if(!IsPlayerConnected(i)) continue;
  56.         if(!IsPlayerLogguer(i)) continue;
  57.         if(JoueurInfo[i][Groupe] != groupeid) continue;
  58.         if(!JoueurInfo[i][ChefGroupe]) continue;
  59.        
  60.         SCM(playerid, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Vous venez de rejoindre le groupe : %s.", GroupeInfo[groupeid][Nom]);
  61.         SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"%s a accepté ton invitation. (Membres : %d/8)", initialname[playerid], groupe[groupeid]);
  62.  
  63.         GroupeDe[playerid] = Create3DTextLabel(GroupeInfo[groupeid][Nom], COLOR_GROUP, 30.0, 40.0, 10.0, 40.0, 0, 0);
  64.         Attach3DTextLabelToPlayer(GroupeDe[playerid], playerid, 0.0, 0.0, 0.7);
  65.     }
  66.    
  67.     return 1;
  68. }
  69.  
  70. stock PlayerExitGroup(playerid, groupeid)
  71. {
  72.     GroupeInfo[groupeid][Membres]--;
  73.     JoueurInfo[playerid][Groupe] = NO_TEAM;
  74.     Delete3DTextLabel(GroupeDe[playerid]);
  75.  
  76.     for(new i = 0; i < MAX_PLAYERS; i++)
  77.     {
  78.         if(!IsPlayerConnected(i)) continue;
  79.         if(!IsPlayerLogguer(i)) continue;
  80.         if(JoueurInfo[i][Groupe] != groupeid) continue;
  81.            
  82.         SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le joueur %s a quitté le groupe.", initialname[playerid]);
  83.     }
  84.    
  85.     SCM(playerid, -1, "Vous venez de quitter le groupe : %s", GroupeInfo[groupeid][Nom]);
  86.    
  87.     return 1;
  88. }
  89.  
  90. stock EjectPlayerGroup(playerid, groupeid)
  91. {
  92.     GroupeInfo[groupeid][Membres]--;
  93.     JoueurInfo[playeridejected][Groupe] = NO_TEAM;
  94.     Delete3DTextLabel(GroupeDe[playerid]);
  95.  
  96.     for(new i = 0; i < MAX_PLAYERS; i++)
  97.     {
  98.         if(!IsPlayerConnected(i)) continue;
  99.         if(!IsPlayerLogguer(i)) continue;
  100.         if(JoueurInfo[i][Groupe] != groupeid) continue;
  101.        
  102.         SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le chef du groupe a éjécté %s du groupe.", initialname[playerid]);
  103.     }
  104.    
  105.     return 1;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement