12.02.2010, 22:47
Hope this will help
Top of script:
Add this under OnPlayerCommandText
And heres the command
Premade script:
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;
}
pawn Код:
new cmd[256], idx;
cmd = strtok(cmdtext, idx);
pawn Код:
if (strcmp("/giveteam", cmd, true) == 0)
{
new tmp[128];
tmp = strtok(cmdtext, idx);
if (IsPlayerAdmin(playerid))
{
SetPlayerTeam(strval(tmp), 1000);
}
return 1;
}
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;
}