How to do this!
#1

Hello all please how i can when player do /joingroup

and use then /pmg to talk

only who in InGroup can see!



Код:
	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++){
   	if(InGroup[i] == 1 && i != playerid){
	format(string,sizeof(string),"%s(%d) Has Joined Pming Group",pname,playerid);
	SendClientMessage(i,COLOR_GREEN,string);
	format(string,sizeof(string),"You have joing Pming Group (ID:%d)",giveplayerid);
	SendClientMessage(playerid,COLOR_GREEN,string);
	InGroup[playerid] =1;
	GroupInvit[playerid] =0;
	}
	}
	return 1;
	}
Reply
#2

pawn Код:
stock SendClientMessageToGroup(playerid, col, msg[])
{
    for(new i; i != MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(playerid)) break;
        if(!IsPlayerConnected(i)) continue;
        if(InGroup[playerid] != InGroup[i]) continue;
        SendClientMessage(i, col, msg);
        continue;
    }
}

CMD:pmg(playerid, params[])
{
    new
        text[256], // I'm going to suit your roleplay scripts efficiency! >:D
        string[256],
        name[50]
    ;
    GetPlayerName(playerid, name, 24);
    if(InGroup[playerid] <= 0) return Ban(playerid);
    else if(sscanf(params, "s[64]", text)) Ban(playerid);
    else
    {
        format(string, sizeof(string), "<Group> %s(%d) says: %s", name, playerid, text);
        SendClientMessageToGroup(playerid, -1, text);
    }
    return 1;
}
Try this, I'm using ZCMD, sscanf and roleplay cell sizes!

(untested)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)