Almost perfect
#1

The code:

Код:
	if(strcmp(cmd, "/team", true) == 0) {  //teams
	    new tmp[256];
	    new gangcmd, gangnum;
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
			return 1;
		}
		giveplayerid = strval(tmp);

		if(strcmp(tmp, "create", true)==0)
		    gangcmd = 1;
		else if(strcmp(tmp, "invite", true)==0)
		    gangcmd = 2;
		else if(strcmp(tmp, "join", true)==0)
		    gangcmd = 3;
		else if(strcmp(tmp, "quit", true)==0)
		    gangcmd = 4;

		tmp = strtok(cmdtext, idx);
		if(gangcmd < 3 && !strlen(tmp)) {
		    if(gangcmd==0)
				SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
			else if(gangcmd==1)
				SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create] [name]");
			else if(gangcmd==2)
				SendClientMessage(playerid, COLOR_WHITE, "USE: /team [invite] [playerid]");
			return 1;
		}

		//create
		if(gangcmd==1) {
		    if(playerGang[playerid]>0) {
				SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
				return 1;
		    }

			for(new i = 1; i < MAX_GANGS; i++) {
				if(gangInfo[i][0]==0) {
					format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
					gangInfo[i][0]=1;
					gangInfo[i][1]=1;
					gangInfo[i][2]=playerColors[playerid];
					gangMembers[i][0] = playerid;
					format(string, sizeof(string),"You created a team '%s' (id: %d)", gangNames[i], i);
					SendClientMessage(playerid, COLOR_GREEN, string);

					playerGang[playerid]=i;

					return 1;
				}
			}

			return 1;

		//joining team
		} else if (gangcmd==3) {
	 		gangnum = gangInvite[playerid];

		    if(playerGang[playerid]>0) {
				SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
				return 1;
		    }
	 		if(gangInvite[playerid]==0) {
				SendClientMessage(playerid, COLOR_RED, "You weren't invited.");
				return 1;
			}
			if(gangInfo[gangnum][0]==0) {
				SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
				return 1;
			}

			if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
			    new i = gangInfo[gangnum][1];

				gangInvite[playerid]=0;

				gangMembers[gangnum][i] = playerid;

			    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
				for(new j = 0; j < gangInfo[gangnum][1]; j++) {
					format(string, sizeof(string),"%s joined a team.", sendername);
					SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
				}

				gangInfo[gangnum][1]++;
				playerGang[playerid] = gangnum;

				SetPlayerColor(playerid,gangInfo[gangnum][2]);

				format(string, sizeof(string),"You joined a team'%s' (id: %d)", gangNames[gangnum], gangnum);
				SendClientMessage(playerid, COLOR_GREEN, string);

				return 1;
			}

			SendClientMessage(playerid, COLOR_RED, "This team is full.");
			return 1;

		//invite
		} else if (gangcmd==2) {
	 		giveplayerid = strval(tmp);

			if(playerGang[playerid]==0) {
				SendClientMessage(playerid, COLOR_RED, "You're not in a team!");
				return 1;
			}
			if(gangMembers[playerGang[playerid]][0]!=playerid) {
				SendClientMessage(playerid, COLOR_RED, "You must be the team leader.");
				return 1;
			}

			if(IsPlayerConnected(giveplayerid)) {
				GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				GetPlayerName(playerid, sendername, sizeof(sendername));

				format(string, sizeof(string),"You invited %s.", giveplayer);
				SendClientMessage(playerid, COLOR_GREEN, string);
				format(string, sizeof(string),"You were invited to join '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
				SendClientMessage(giveplayerid, COLOR_GREEN, string);

				gangInvite[giveplayerid]=playerGang[playerid];

			} else
				SendClientMessage(playerid, COLOR_RED, "Player does not exist!");

		//quit
		} else if (gangcmd==4) {
		    PlayerLeaveGang(playerid);
		}

		return 1;
	}

	//info

	if(strcmp(cmd, "/teaminfo", true) == 0) {
	    new tmp[256];
	    new gangnum;
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp) && playerGang[playerid]==0) {
			SendClientMessage(playerid, COLOR_WHITE, "USE: /teaminfo [name/number]");
			return 1;
		} else if (!strlen(tmp))
			gangnum = playerGang[playerid];
		else
			gangnum = strval(tmp);

		if(gangInfo[gangnum][0]==0) {
			SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
			return 1;
		}

		format(string, sizeof(string),"'%s' Team Members (id: %d)", gangNames[gangnum], gangnum);
		SendClientMessage(playerid, COLOR_GREEN, string);

		for(new i = 0; i < gangInfo[gangnum][1]; i++) {
			GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
			format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}

	//teams

	if(strcmp(cmd, "/teams", true) == 0)
	{
		new AB;

		SendClientMessage(playerid, COLOR_GREEN, "Teams:");
	    for(new i=0; i < MAX_GANGS; i++) {
			if(gangInfo[i][0]==1) {
				format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

				AB++;
				if(x > 2) {
				    SendClientMessage(playerid, COLOR_YELLOW, string);
				    AB = 0;
					format(string, sizeof(string), "");
				} else {
					format(string, sizeof(string), "%s, ", string);
				}
			}
		}

		if(AB <= 2 && AB > 0) {
			string[strlen(string)-2] = '.';
		    SendClientMessage(playerid, COLOR_YELLOW, string);
		}

		return 1;
	}

	return 1;
}

The line:

Код:
	format(string, sizeof(string),"You created a team '%s' (id: %d)", gangNames[i], i);
Reply
#2

new string[128];
Reply
#3

Lol you forgot:
pawn Код:
new string[128];
Reply
#4

where do I put it ?
Reply
#5

pawn Код:
new tmp[256], string[128];
After tmp[256] after /team .

EDIT:
pawn Код:
if(strcmp(cmd, "/team", true) == 0) {  //teams
        new tmp[256], string[128];
        new gangcmd, gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0)
            gangcmd = 1;
        else if(strcmp(tmp, "invite", true)==0)
            gangcmd = 2;
        else if(strcmp(tmp, "join", true)==0)
            gangcmd = 3;
        else if(strcmp(tmp, "quit", true)==0)
            gangcmd = 4;

        tmp = strtok(cmdtext, idx);
        if(gangcmd < 3 && !strlen(tmp)) {
            if(gangcmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            else if(gangcmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create] [name]");
            else if(gangcmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [invite] [playerid]");
            return 1;
        }

        //create
        if(gangcmd==1) {
            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }

            for(new i = 1; i < MAX_GANGS; i++) {
                if(gangInfo[i][0]==0) {
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    gangInfo[i][0]=1;
                    gangInfo[i][1]=1;
                    gangInfo[i][2]=playerColors[playerid];
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You created a team '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerGang[playerid]=i;

                    return 1;
                }
            }

            return 1;

        //joining team
        } else if (gangcmd==3) {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }
            if(gangInvite[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You weren't invited.");
                return 1;
            }
            if(gangInfo[gangnum][0]==0) {
                SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
                return 1;
            }

            if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
                new i = gangInfo[gangnum][1];

                gangInvite[playerid]=0;

                gangMembers[gangnum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < gangInfo[gangnum][1]; j++) {
                    format(string, sizeof(string),"%s joined a team.", sendername);
                    SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
                }

                gangInfo[gangnum][1]++;
                playerGang[playerid] = gangnum;

                SetPlayerColor(playerid,gangInfo[gangnum][2]);

                format(string, sizeof(string),"You joined a team'%s' (id: %d)", gangNames[gangnum], gangnum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }

            SendClientMessage(playerid, COLOR_RED, "This team is full.");
            return 1;

        //invite
        } else if (gangcmd==2) {
            giveplayerid = strval(tmp);

            if(playerGang[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You're not in a team!");
                return 1;
            }
            if(gangMembers[playerGang[playerid]][0]!=playerid) {
                SendClientMessage(playerid, COLOR_RED, "You must be the team leader.");
                return 1;
            }

            if(IsPlayerConnected(giveplayerid)) {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You invited %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You were invited to join '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                gangInvite[giveplayerid]=playerGang[playerid];

            } else
                SendClientMessage(playerid, COLOR_RED, "Player does not exist!");

        //quit
        } else if (gangcmd==4) {
            PlayerLeaveGang(playerid);
        }

        return 1;
    }

    //info

    if(strcmp(cmd, "/teaminfo", true) == 0) {
        new tmp[256];
        new gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /teaminfo [name/number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Team Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //teams

    if(strcmp(cmd, "/teams", true) == 0)
    {
        new AB;

        SendClientMessage(playerid, COLOR_GREEN, "Teams:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                AB++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    AB = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(AB <= 2 && AB > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    return 1;
}
Reply
#6

can u send me this include? i lost it
Reply
#7

pawn Код:
if(strcmp(cmd, "/team", true) == 0) {  //teams
        new tmp[256], string[128];
        new gangcmd, gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0)
            gangcmd = 1;
        else if(strcmp(tmp, "invite", true)==0)
            gangcmd = 2;
        else if(strcmp(tmp, "join", true)==0)
            gangcmd = 3;
        else if(strcmp(tmp, "quit", true)==0)
            gangcmd = 4;

        tmp = strtok(cmdtext, idx);
        if(gangcmd < 3 && !strlen(tmp)) {
            if(gangcmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            else if(gangcmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create] [name]");
            else if(gangcmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [invite] [playerid]");
            return 1;
        }

        //create
        if(gangcmd==1) {
            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }

            for(new i = 1; i < MAX_GANGS; i++) {
                if(gangInfo[i][0]==0) {
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    gangInfo[i][0]=1;
                    gangInfo[i][1]=1;
                    gangInfo[i][2]=playerColors[playerid];
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You created a team '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerGang[playerid]=i;

                    return 1;
                }
            }

            return 1;

        //joining team
        } else if (gangcmd==3) {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }
            if(gangInvite[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You weren't invited.");
                return 1;
            }
            if(gangInfo[gangnum][0]==0) {
                SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
                return 1;
            }

            if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
                new i = gangInfo[gangnum][1];

                gangInvite[playerid]=0;

                gangMembers[gangnum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < gangInfo[gangnum][1]; j++) {
                    format(string, sizeof(string),"%s joined a team.", sendername);
                    SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
                }

                gangInfo[gangnum][1]++;
                playerGang[playerid] = gangnum;

                SetPlayerColor(playerid,gangInfo[gangnum][2]);

                format(string, sizeof(string),"You joined a team'%s' (id: %d)", gangNames[gangnum], gangnum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }

            SendClientMessage(playerid, COLOR_RED, "This team is full.");
            return 1;

        //invite
        } else if (gangcmd==2) {
            giveplayerid = strval(tmp);

            if(playerGang[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You're not in a team!");
                return 1;
            }
            if(gangMembers[playerGang[playerid]][0]!=playerid) {
                SendClientMessage(playerid, COLOR_RED, "You must be the team leader.");
                return 1;
            }

            if(IsPlayerConnected(giveplayerid)) {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You invited %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You were invited to join '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                gangInvite[giveplayerid]=playerGang[playerid];

            } else
                SendClientMessage(playerid, COLOR_RED, "Player does not exist!");

        //quit
        } else if (gangcmd==4) {
            PlayerLeaveGang(playerid);
        }

        return 1;
    }

    //info

    if(strcmp(cmd, "/teaminfo", true) == 0) {
        new tmp[256];
        new gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /teaminfo [name/number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Team Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //teams

    if(strcmp(cmd, "/teams", true) == 0)
    {
        new AB;

        SendClientMessage(playerid, COLOR_GREEN, "Teams:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                AB++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    AB = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(AB <= 2 && AB > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    return 1;
}
Reply
#8

Did you use giveplayer = bla bla
Better use ZCMD+insull
Reply
#9

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])

{
    new playername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new giveplayerid;
    new cmd[256];
    new target, idx;
    cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, playername, sizeof playername);

pawn Код:
if(strcmp(cmd, "/team", true) == 0) {  //teams
        new tmp[256], string[128];
        new gangcmd, gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0)
            gangcmd = 1;
        else if(strcmp(tmp, "invite", true)==0)
            gangcmd = 2;
        else if(strcmp(tmp, "join", true)==0)
            gangcmd = 3;
        else if(strcmp(tmp, "quit", true)==0)
            gangcmd = 4;

        tmp = strtok(cmdtext, idx);
        if(gangcmd < 3 && !strlen(tmp)) {
            if(gangcmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create/join/invite/quit] [name/id]");
            else if(gangcmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [create] [name]");
            else if(gangcmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USE: /team [invite] [playerid]");
            return 1;
        }

        //create
        if(gangcmd==1) {
            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }

            for(new i = 1; i < MAX_GANGS; i++) {
                if(gangInfo[i][0]==0) {
                    format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
                    gangInfo[i][0]=1;
                    gangInfo[i][1]=1;
                    gangInfo[i][2]=playerColors[playerid];
                    gangMembers[i][0] = playerid;
                    format(string, sizeof(string),"You created a team '%s' (id: %d)", gangNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerGang[playerid]=i;

                    return 1;
                }
            }

            return 1;

        //joining team
        } else if (gangcmd==3) {
            gangnum = gangInvite[playerid];

            if(playerGang[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You're already in a team!");
                return 1;
            }
            if(gangInvite[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You weren't invited.");
                return 1;
            }
            if(gangInfo[gangnum][0]==0) {
                SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
                return 1;
            }

            if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS) {
                new i = gangInfo[gangnum][1];

                gangInvite[playerid]=0;

                gangMembers[gangnum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < gangInfo[gangnum][1]; j++) {
                    format(string, sizeof(string),"%s joined a team.", sendername);
                    SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
                }

                gangInfo[gangnum][1]++;
                playerGang[playerid] = gangnum;

                SetPlayerColor(playerid,gangInfo[gangnum][2]);

                format(string, sizeof(string),"You joined a team'%s' (id: %d)", gangNames[gangnum], gangnum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }

            SendClientMessage(playerid, COLOR_RED, "This team is full.");
            return 1;

        //invite
        } else if (gangcmd==2) {
            giveplayerid = strval(tmp);

            if(playerGang[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You're not in a team!");
                return 1;
            }
            if(gangMembers[playerGang[playerid]][0]!=playerid) {
                SendClientMessage(playerid, COLOR_RED, "You must be the team leader.");
                return 1;
            }

            if(IsPlayerConnected(giveplayerid)) {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You invited %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You were invited to join '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                gangInvite[giveplayerid]=playerGang[playerid];

            } else
                SendClientMessage(playerid, COLOR_RED, "Player does not exist!");

        //quit
        } else if (gangcmd==4) {
            PlayerLeaveGang(playerid);
        }

        return 1;
    }

    //info

    if(strcmp(cmd, "/teaminfo", true) == 0) {
        new tmp[256];
        new gangnum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerGang[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USE: /teaminfo [name/number]");
            return 1;
        } else if (!strlen(tmp))
            gangnum = playerGang[playerid];
        else
            gangnum = strval(tmp);

        if(gangInfo[gangnum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "This team does not exist!");
            return 1;
        }

        format(string, sizeof(string),"'%s' Team Members (id: %d)", gangNames[gangnum], gangnum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < gangInfo[gangnum][1]; i++) {
            GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    //teams

    if(strcmp(cmd, "/teams", true) == 0)
    {
        new AB;

        SendClientMessage(playerid, COLOR_GREEN, "Teams:");
        for(new i=0; i < MAX_GANGS; i++) {
            if(gangInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

                AB++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    AB = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(AB <= 2 && AB > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }

        return 1;
    }

    return 1;
}
Reply
#10

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new playername[MAX_PLAYER_NAME];
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new giveplayerid;
    new cmd[256], string[128];   // add string here
    new target, idx;
    cmd = strtok(cmdtext, idx);
    GetPlayerName(playerid, playername, sizeof playername);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)