Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define IsValidGroup(%0) (GroupeInfo[%0][Chef] == INVALID_PLAYER_ID)
- #define GetPlayerNameChefGroupe(%0) initialname[GroupeInfo[%0][Chef]]
- #define GetNumberMembersGroup(%0) (GroupeInfo[%0][Membres])
- stock PlayerCreateGroup(playerid)
- {
- new
- groupeid;
- for(groupeid = MIN_GROUP; groupeid < MAX_GROUP; groupeid++)
- if(IsValidGroup(groupeid)) break; // si il y a déjà un chef de groupe
- JoueurInfo[playerid][Groupe] = groupeid;
- JoueurInfo[playerid][ChefGroupe] = true;
- GroupeInfo[groupeid][Chef] = playerid;
- GroupeInfo[groupeid][Membres]++;
- SCM(playerid, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Ton groupe a bien été créé. Utilise de nouveau /groupe pour inviter des joueurs.", groupeid);
- format(GroupeInfo[groupeid][Nom], sizeof(GroupeInfo[groupeid][Nom]), "Groupe de %s", initialname[playerid]);
- GroupeDe[playerid] = Create3DTextLabel(GroupeInfo[groupeid][Nom], COLOR_GROUP, 30.0, 40.0, 10.0, 35.0, 0, 0);
- Attach3DTextLabelToPlayer(GroupeDe[playerid], playerid, 0.0, 0.0, 0.7);
- return 1;
- }
- stock PlayerRemoveGroup(playerid, groupeid)
- {
- JoueurInfo[playerid][ChefGroupe] = false;
- JoueurInfo[groupeid][Chef] = INVALID_PLAYER_ID;
- JoueurInfo[groupeid][Membres] = 0;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(!IsPlayerLogguer(i)) continue;
- if(JoueurInfo[i][Groupe] != groupeid) continue;
- JoueurInfo[i][Groupe] = NO_TEAM;
- SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le chef du groupe %s a supprimé le groupe.", initialname[playerid]);
- Delete3DTextLabel(GroupeDe[i]);
- }
- return 1;
- }
- stock PlayerJoinGroup(playerid, groupeid)
- {
- JoueurInfo[playerid][Groupe] = groupeid;
- GroupeInfo[groupeid][Membres]++;
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(!IsPlayerLogguer(i)) continue;
- if(JoueurInfo[i][Groupe] != groupeid) continue;
- if(!JoueurInfo[i][ChefGroupe]) continue;
- SCM(playerid, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Vous venez de rejoindre le groupe : %s.", GroupeInfo[groupeid][Nom]);
- SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"%s a accepté ton invitation. (Membres : %d/8)", initialname[playerid], groupe[groupeid]);
- GroupeDe[playerid] = Create3DTextLabel(GroupeInfo[groupeid][Nom], COLOR_GROUP, 30.0, 40.0, 10.0, 40.0, 0, 0);
- Attach3DTextLabelToPlayer(GroupeDe[playerid], playerid, 0.0, 0.0, 0.7);
- }
- return 1;
- }
- stock PlayerExitGroup(playerid, groupeid)
- {
- GroupeInfo[groupeid][Membres]--;
- JoueurInfo[playerid][Groupe] = NO_TEAM;
- Delete3DTextLabel(GroupeDe[playerid]);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(!IsPlayerLogguer(i)) continue;
- if(JoueurInfo[i][Groupe] != groupeid) continue;
- SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le joueur %s a quitté le groupe.", initialname[playerid]);
- }
- SCM(playerid, -1, "Vous venez de quitter le groupe : %s", GroupeInfo[groupeid][Nom]);
- return 1;
- }
- stock EjectPlayerGroup(playerid, groupeid)
- {
- GroupeInfo[groupeid][Membres]--;
- JoueurInfo[playeridejected][Groupe] = NO_TEAM;
- Delete3DTextLabel(GroupeDe[playerid]);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- if(!IsPlayerLogguer(i)) continue;
- if(JoueurInfo[i][Groupe] != groupeid) continue;
- SCM(i, COLOR_GROUP, ""BLEU_LEGER"[Groupe] "BLANC"Le chef du groupe a éjécté %s du groupe.", initialname[playerid]);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement