How to create an Admin Comand!?
#1

Hi All

I Was Woundering If Someone can help me here with admins comands.

I Want To Do Something Like This:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp"(/disarm", cmdtext, true) ==0)
{
ResetPlayerWeapon(playerid);
return 1;
USAGE: /disarm [ID]

I Want It On Level 1337 Admin.

Can SomeOne Explaine me How To?
Reply
#2

you need something like this
pawn Код:
if ( [admin level] < 1337)
  return 0;
Reply
#3

And you need to define giveplayerid and use strtok.
Reply
#4

Quote:
Originally Posted by Rk_
And you need to define giveplayerid and use strtok.
And what is giveplayerid?..


pawn Код:
strtok(const string[], &index, separator = ' ')
{
  new length = strlen(string);
  while ((index < length) && (string[index] <= separator))
  {
    index++;
  }
  new offset = index;
  new result[20];
  while ((index < length) && (string[index] > separator) && ((index - offset) < (sizeof(result) - 1)))
  {
    result[index - offset] = string[index];
    index++;
  }
  result[index - offset] = EOS;
  return result;
}
pawn Код:
new
  cmd[128],
  id;
if(!strcmp(cmd,"/disarm",true))
{
  if ([admin level]<1337)
    return 0;
  cmd=strtok(cmdtext,idx);
  if(!strlen(cmd))
    return SendClientMessage(playerid,color,"USAGE: /disarm [ID]");
  id=ReturnUser(cmd);
  if(!IsPlayerConnected(id))
    return 0;
  ResetPlayerWeapons(id);
  return 1;
}
It's edited because I wrongly posted before finishing the code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)