Quote:
Originally Posted by Sasoft
Something like this?
pawn Code:
CMD:invite(playerid,params[]) { if(PlayerInfo[playerid][pGroup] == 1) { new targetid; if(PlayerInfo[playerid][Group] == 255) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You're not in a group "); if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_SYNTAX,"[SYNTAX]: /invite [targetid] "); if(targetid==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: Player is not connected. "); else { PlayerInfo[playerid][pGroup] =1; SendClientMessage(playerid, COLOR_GREY, "You've have been invited to our Group."); } } else if(PlayerInfo[playerid][pGroup] == 2) { new targetid; if(PlayerInfo[playerid][Group] == 255) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You're not in a group "); if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_SYNTAX,"[SYNTAX]: /invite [targetid] "); if(targetid==INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: Player is not connected. "); else { PlayerInfo[playerid][pGroup] =2; SendClientMessage(playerid, COLOR_GREY, "You've have been invited to our Group."); } }
|
I'd say thats a waste of time and code if he has like hundreds of groups. Basically check if he is in some kind of group and give the targetid an invite, example:
InvitedToGroup[targetid] = PlayerInfo[playerid][pGroup];
after he writes /accept or whatever, just set his PlayerInfo[playerid][pGroup]=InvitedToGroup[playerid]; // playerid because in /accept cmd he will be the player.
edit: sry for misunderstanding in my first post ^^