Help With This
#1

this command or for some people go in group and talk together but i got problem when someone else Create his own group and type /pmg

to talk other player who in other group can see what he talk! help guys


Код:
	///////////////// PMING GROUP//
	if(strcmp(cmdtext, "/creategroup", true) == 0)
	{
	if(GroupOwner[playerid] == 1 && GroupCreated[playerid] == 1){
	SendClientMessage(playerid,COLOR_ERROR,"You already got your own group.");
	return 1;
	}
	if(InGroup[playerid] == 1){
	SendClientMessage(playerid,COLOR_ERROR,"You already inside other group! use /leavegroup. then create");
	return 1;
	}
	InGroup[playerid] =1;
	GroupOwner[playerid] =1;
	GroupCreated[playerid] =1;
	format(string,sizeof(string),"You have create group (ID:%d). Use /invite (id) to invite players",playerid);
	SendClientMessage(playerid,COLOR_GREEN,string);
	return 1;
	}


	if(strcmp(cmdtext, "/removegroup", true) == 0 && GroupOwner[playerid] == 1)
	{
	if(InGroup[playerid] == 0){
	SendClientMessage(playerid,COLOR_ERROR,"You already not in any Pming Group");
	return 1;
	}
	for(new i=0;i<MAX_PLAYERS;i++){
	if(InGroup[i] == 1){
	InGroup[i] =0;
	GroupOwner[playerid] =0;
	GroupCreated[playerid] =0;
	SendClientMessage(playerid,COLOR_GREEN,"You have removed your own group!");
	if(i != playerid){
	SendClientMessage(i,COLOR_GREEN,"Group: group is been deleted by group owner!");
	}
	}
	}
	return 1;
	}

	if(strcmp(cmd, "/invite", true) == 0 && GroupOwner[playerid] == 1)
	{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /invite (id)");
    return 1;
    }
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /invite (id) ID Must be a number");
    return 1;
    }
    giveplayerid = strval(tmp);
    if(InGroup[giveplayerid] == 1){
    SendClientMessage(playerid,COLOR_ERROR,"This player is already in group!");
    return 1;
    }
    new pname[24];
    new oname[24];
	GetPlayerName(playerid,pname,24);
	GetPlayerName(giveplayerid,oname,24);
    GroupInvit[giveplayerid] =1;
	format(string,sizeof(string),"Group (ID:%d) Owner Has invited you to join his group! Use /joingroup %d to join group",playerid,playerid);
	SendClientMessage(giveplayerid,COLOR_GREEN,string);
	format(string,sizeof(string),"You have invited %s(%d) To join your Group (ID:%d)",oname,giveplayerid,playerid);
	SendClientMessage(playerid,COLOR_GREEN,string);
	return 1;
	}


	if(strcmp(cmd, "/joingroup", true) == 0)
	{
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /joingroup (id)");
    return 1;
    }
    if(!IsNumeric(tmp)) {
    SendClientMessage(playerid, COLOR_ERROR, "USAGE: /joingroup (id) ID Must be a number");
    return 1;
    }
    giveplayerid = strval(tmp);
    if(InGroup[playerid] == 1){
    SendClientMessage(playerid,COLOR_ERROR,"You are already in group!");
    return 1;
    }
    if(GroupInvit[giveplayerid] == 0){
    format(string,sizeof(string),"You are not invited to Group (ID:%d)",giveplayerid);
    return 1;
    }
    if(GroupOwner[giveplayerid] == 0){
    format(string,sizeof(string),"This player is dont have his own group!");
    return 1;
    }
    new pname[24];
    new oname[24];
	GetPlayerName(playerid,pname,24);
	GetPlayerName(giveplayerid,oname,24);
    for(new i=0;i<MAX_PLAYERS;i++){
   	format(string,sizeof(string),"You have joing Pming Group (ID:%d)",giveplayerid);
   	SendClientMessage(playerid,COLOR_GREEN,string);
   	if(InGroup[i] == 1 && i != playerid){
	format(string,sizeof(string),"%s(%d) Has Joined Pming Group",pname,playerid);
	SendClientMessage(i,COLOR_GREEN,string);
	InGroup[playerid] =1;
	GroupInvit[playerid] =0;
	}
	return 1;
	}
}



	if(strcmp(cmd, "/leavegroup", true) == 0)
	{
    if(InGroup[playerid] == 0){
    SendClientMessage(playerid,COLOR_ERROR,"You are already left the group");
    return 1;
    }
    if(GroupOwner[giveplayerid] == 1){
    format(string,sizeof(string),"You cant leave your own group!");
    return 1;
    }
    new pname[24];
    new oname[24];
	GetPlayerName(playerid,pname,24);
	GetPlayerName(giveplayerid,oname,24);
    for(new i=0;i<MAX_PLAYERS;i++){
   	format(string,sizeof(string),"You have left Pming Group (ID:%d)",giveplayerid);
   	SendClientMessage(playerid,COLOR_GREEN,string);
   	if(InGroup[i] == 1 && i != playerid){
	format(string,sizeof(string),"%s(%d) Has Left Pming Group",pname,playerid);
	SendClientMessage(i,COLOR_GREEN,string);
	InGroup[playerid] =0;
	GroupInvit[playerid] =0;
	}
	}
	return 1;
	}


   	if(strcmp(cmd,"/pmg",true)==0)
	{
	if(InGroup[playerid] == 0) {
	SendClientMessage(playerid,COLOR_ERROR,"You are not in any pming group!");
    return 1;
    }
    if(InGroup[playerid] == 1) {
    new output[150];
	new pname[24];
	GetPlayerName(playerid,pname,24);
    strmid(output,cmdtext,4,strlen(cmdtext));
    format(string, sizeof(string), "(PMIGN GROUP): %s(%d) %s",pname,playerid,output);
    printf("%s", string);
    for(new i=0;i<MAX_PLAYERS;i++)
	{
	if(InGroup[i] == 1) {
	SendClientMessage(i,COLOR_YELLOW,string);
    }
    }
	}
    return 1;
    }
Reply
#2

You have one single value to check if the player is in a certain group. You don't assign the groups ID's and therefore you will be unable to send the group members a message. Take a look at my groups script HERE to get a better idea.
Reply
#3

TheKiller i try to do that with your creategroup command but its not work


Код:
if(strcmp(cmdtext, "/creategroup", true) == 0)
	{
    tmp = strtok(cmdtext, idx);
  	if(group[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Leave your group with {FFFFFF}/leavegroup{FF0000} before creating a new one!");
  	if(strlen(tmp) > 49 || strlen(tmp) < 3) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/creategroup{FF0000} (Group name 3-50 characters)!");
	if(IsGroupTaken(tmp)) return SendClientMessage(playerid, 0xFF0000, "Group name is already in use!");
	CreateGroup(tmp, playerid);
  	return 1;
	}
Reply
#4

why when i add the tmp the command stop work

!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)