[HELP]Tele for only specific people?
#1

Hello guys
I've tried an failed so many times but can someone help me with making a tele for a certain group of people?
And a CMD that helps add people to that list?

For example
I have a group of people that has:
Jim
Willy
Star wars
and i Want it so only them three can use /teletowhatever

Can someone show me and example please, i've been trying all day
Reply
#2

You could simply store their IDs in an array and check if the ID matches, if so, make it happen:
pawn Код:
// Near the top of the script
new gCanUse[ MAX_PLAYERS ];

// In OnPlayerCommandText
new cmd[ 256 ], tmp [ 256 ], idx;
cmd = strtok( cmdtext, idx );

// The "Add" command
if( !strcmp( cmd, "/add", true ) )
{
   if(!strlen(tmp)) return SendClientMessage( playerid, 0x00FF00FF, "Usage: /add <id>" );
   if(!IsPlayerConnected(strval(tmp))) return SendClientMessage( playerid, 0x00FF00FF, "Invalid ID");
   gCanUse[ strval(tmp) ] = 1;
   SendClientMessage( playerid, 0x00FF00FF, "Player added");
   SendClientMessage( strval(tmp), 0x00FF00FF, "You can now use the command" );
   return 1;
}
// The command you need special permission to use
if( !strcmp(cmdtext, "/mycommand", true ) )
{
   if( gCanUse[ playerid ] == 0 ) return SendClientMessage( playerid, 0x00FF00FF, "Error: You cannot use this command." );
    // Do the rest of the command here
   return 1;
}

// Under OnPlayerDisconnect
gCanUse[ playerid ] = 0;
This is a short and quick written example, hopefully you can understand and implement it into your script. Also, I do not usually recommend the strtok + strcmp method of doing commands, but it was the fastest I could type up. You may want to later change that into Zcmd, since it's the fastest command processor.
Reply
#3

what about multiple groups?
Reply
#4

Then it would get more complicated - Storing the player's group into a separate array along with the people in the group - Then check in the command if the group is like that of which I provided.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)