12.03.2012, 06:43
How to save positions using y_ini
Now, about teams. If you are making a RP gamemode. Then you would use an enum.
Let's make a simple command that invites a player to the team.
This is how you would make commands.
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];
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;
}
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;
}