[HELP] Giveteam
#1

I Know how to make a RCON command,
I Know how to make a Normal command.
I wanna make a Giveteam command that i can give Other players a Team.
This command i have:
pawn Код:
if (strcmp("/giveteam", cmdtext, true, 10) == 0)
    {
  if (IsPlayerAdmin(playerid))
    {
    SetPlayerTeam(playerid, 1000);
        return 1;
    }
    }
But with this code i can give only myself a team.
Reply
#2

Anyone?
Reply
#3

https://sampwiki.blast.hk/wiki/Fast_Commands
Reply
#4

I getted warning and error.
Script:
pawn Код:
dcmd(makevip, 4, cmdtext);
    return 0;
}
dcmd_makevip(playerid, params[])
{
    if (strlen(params))
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
            SetPlayerTeam(playerid, 1000);
            SendClientMessage(id, 0x00FF00AA, "You are now a Vip!");
            SendClientMessage(playerid, 0x00FF00AA, "Player is now Vip");
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/makevip <playerid>\"");
    }
    return 1;
}
Compile errors:

D:\GTASanAndreas\samp03asvr_R4_win32\gamemodes\URP G.pwn(186) : error 017: undefined symbol "dcmd"
D:\GTASanAndreas\samp03asvr_R4_win32\gamemodes\URP G.pwn(220) : warning 203: symbol is never used: "dcmd_makevip"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

Add this to your script

pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Reply
#6

Now i have:
D:\GTASanAndreas\samp03asvr_R4_win32\gamemodes\URP G.pwn(194) : error 017: undefined symbol "id"
D:\GTASanAndreas\samp03asvr_R4_win32\gamemodes\URP G.pwn(195) : error 017: undefined symbol "id"
D:\GTASanAndreas\samp03asvr_R4_win32\gamemodes\URP G.pwn(19 : error 017: undefined symbol "id"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#7

pawn Код:
new id = strval(params);
Reply
#8

Also change

pawn Код:
SetPlayerTeam(playerid, 1000);
to

pawn Код:
SetPlayerTeam(id, 1000);
Reply
#9

it not works, if i compile it not will finish.
Reply
#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


Forum Jump:


Users browsing this thread: 2 Guest(s)