Member Help
#2

Using ZCMD:
pawn Код:
CMD:members(playerid,params[])
{
    if(Gangvar[playerid] == 0) return SendClientMessage(playerid,-1,"You're not in any gang");//preventing the player from doing the command if he/she is not in a gang
    new string[128],pName[MAX_PLAYER_NAME];//declare the string which we're going to format a little later, aswell as the name string
    SendClientMessage(playerid,-1,"Current members online in your gang:");
    for(new i=0; i < MAX_PLAYERS; i++)//here we loop trough all players online at the moment
    {
        if(Gangvar[i] == Gangvar[playerid])//if the player is in the same gang as the command executer, continue
        {
        GetPlayerName(i,pName,MAX_PLAYER_NAME);//format the name string with the member's name
        format(string,sizeof(string),"* %s",pName);//format the string with the name of the online member
        SendClientMessage(playerid,-1,string);//send the formatted string to the player
        }
    }
    return 1;//to let the script know this was a valid command
}
You can't just copy/paste this code, since it does not contain the variables you use (probably). Check the comments I put behind each line, they explain exactly what happens.
Reply


Messages In This Thread
Member Help - by CurlyPwn - 07.05.2013, 11:46
Re: Member Help - by Jstylezzz - 07.05.2013, 12:00
Re: Member Help - by CurlyPwn - 07.05.2013, 12:27
Re: Member Help - by CurlyPwn - 07.05.2013, 12:30
Re: Member Help - by Jstylezzz - 07.05.2013, 12:32
Re: Member Help - by CurlyPwn - 07.05.2013, 12:40
Re: Member Help - by Jstylezzz - 07.05.2013, 12:49
Re: Member Help - by CurlyPwn - 07.05.2013, 12:53
Re: Member Help - by Pottus - 07.05.2013, 13:17
Re: Member Help - by CurlyPwn - 07.05.2013, 13:22

Forum Jump:


Users browsing this thread: 3 Guest(s)