[HELP] Giveteam -
icorne - 12.02.2010
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.
Re: [HELP] Giveteam -
icorne - 12.02.2010
Anyone?
Re: [HELP] Giveteam -
MadeMan - 12.02.2010
https://sampwiki.blast.hk/wiki/Fast_Commands
Re: [HELP] Giveteam -
icorne - 12.02.2010
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.
Re: [HELP] Giveteam -
MadeMan - 12.02.2010
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
Re: [HELP] Giveteam -
icorne - 12.02.2010
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.
Re: [HELP] Giveteam -
MadeMan - 12.02.2010
Re: [HELP] Giveteam -
MadeMan - 12.02.2010
Also change
pawn Код:
SetPlayerTeam(playerid, 1000);
to
Re: [HELP] Giveteam -
icorne - 12.02.2010
it not works, if i compile it not will finish.
Re: [HELP] Giveteam -
bajskorv123 - 12.02.2010
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;
}