How to create an Admin Comand!?
#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


Messages In This Thread
How to create an Admin Comand!? - by Fragoso - 03.04.2009, 11:27
Re: How to create an Admin Comand!? - by [RP]Rav - 03.04.2009, 11:35
Re: How to create an Admin Comand!? - by Rks25 - 03.04.2009, 12:12
Re: How to create an Admin Comand!? - by MenaceX^ - 03.04.2009, 12:16

Forum Jump:


Users browsing this thread: 1 Guest(s)