[HELP] Giveteam
#10

Hope this will help

Top of script:
pawn Код:
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Add this under OnPlayerCommandText
pawn Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
And heres the command
pawn Код:
if (strcmp("/giveteam", cmd, true) == 0)
{
  new tmp[128];
  tmp = strtok(cmdtext, idx);

  if (IsPlayerAdmin(playerid))
  {
    SetPlayerTeam(strval(tmp), 1000);
  }
  return 1;
}
Premade script:
pawn Код:
#include <a_samp>

stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  new cmd[256], idx;
  cmd = strtok(cmdtext, idx);

  if (strcmp("/giveteam", cmd, true) == 0)
  {
    new tmp[128];
    tmp = strtok(cmdtext, idx);

    if (IsPlayerAdmin(playerid))
    {
      SetPlayerTeam(strval(tmp), 1000);
    }
    return 1;
  }
  return 0;
}
Reply


Messages In This Thread
[HELP] Giveteam - by icorne - 12.02.2010, 18:12
Re: [HELP] Giveteam - by icorne - 12.02.2010, 18:43
Re: [HELP] Giveteam - by MadeMan - 12.02.2010, 20:43
Re: [HELP] Giveteam - by icorne - 12.02.2010, 21:07
Re: [HELP] Giveteam - by MadeMan - 12.02.2010, 21:09
Re: [HELP] Giveteam - by icorne - 12.02.2010, 21:11
Re: [HELP] Giveteam - by MadeMan - 12.02.2010, 21:25
Re: [HELP] Giveteam - by MadeMan - 12.02.2010, 21:28
Re: [HELP] Giveteam - by icorne - 12.02.2010, 21:36
Re: [HELP] Giveteam - by bajskorv123 - 12.02.2010, 22:47

Forum Jump:


Users browsing this thread: 1 Guest(s)