Hello I have a fue questions..
#10

How to save positions using y_ini


Now, about teams. If you are making a RP gamemode. Then you would use an enum.
pawn Код:
enum Info
{
    pFaction,
    pRank
}
new PlayerInfo[MAX_PLAYERS][Info];
Let's make a simple command that invites a player to the team.
pawn Код:
enum Info
{
    pFaction,
    pRank
}
new PlayerInfo[playerid][Info]

/*
This is using ZCMD and sscanf2
switch to it if you haven't already
*/

CMD:invite(playerid,params[])
{
    new targetid, // A new variable that will who will join the team.

    // This is an admin only command.
    if(!IsPlayerAdmin(playerid)) // The ! is if he isn't.
    {
        // If he isn't admin, then it sends the message below.
        return SendClientMessage(playerid,-1,"You are not authorised to use this command.");
    }
    if(sscanf(params,"u",targetid)) // If they typed the command wrong, then sends this message
    {
        return SendClientMessage(playerid,-1,"USAGE: /invite [playerid]");
    }
    else // If they typed the command correctly
    {
        new name1[24],name2[24],string[124];
        GetPlayerName(playerid,name1,24);
        GetPlayerName(targetid,name2,24);
       
        format(string,sizeof(string),"%s has invited %s to their group.",name1,name2);
        SendClientMessageToAll(-1,string);
       
        PlayerInfo[targetid][pFaction] = 1; // Set's their faction to 1
        return 1;
    }
    return 1;
}
This is how you would make commands.
pawn Код:
CMD:mycommand(playerid,params[])
{
    if(PlayerInfo[playerid][pFaction] != 1) // If they are not in faction 1
    {
        // Then it sends the message.
        return SendClientMessage(playerid,-1,"You are not in this group.");
    }
    else // If they are in faction 1 then
    {
        // your code here
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Hello I have a fue questions.. - by Scrillex - 12.03.2012, 02:39
Re : Hello I have a fue questions.. - by vernz - 12.03.2012, 02:44
Re: Hello I have a fue questions.. - by Scrillex - 12.03.2012, 02:54
Re : Hello I have a fue questions.. - by vernz - 12.03.2012, 02:55
Re: Hello I have a fue questions.. - by Scrillex - 12.03.2012, 02:56
Re : Hello I have a fue questions.. - by vernz - 12.03.2012, 02:59
Re: Hello I have a fue questions.. - by Scrillex - 12.03.2012, 03:01
Re : Hello I have a fue questions.. - by vernz - 12.03.2012, 03:09
Re: Hello I have a fue questions.. - by Scrillex - 12.03.2012, 03:10
Re: Hello I have a fue questions.. - by ReneG - 12.03.2012, 06:43

Forum Jump:


Users browsing this thread: 2 Guest(s)