How to make a command for a certain team only -
Rabbayazza - 13.08.2011
I have teams set out, I need to make it so that if they were to do a command, it would work, but if another team tried to do it, it would say "You need to be in the Police Force to use this command." help?
Re: How to make a command for a certain team only -
[MG]Dimi - 13.08.2011
PHP код:
//in case you used AddPlayerClassEx
new teamid = GetPlayerTeam(playerid);
if(teamid == 1/2)//whatever
{
If you used other type of defining teams please post it
Re: How to make a command for a certain team only -
Ironboy - 13.08.2011
try this
pawn Код:
if (strcmp("/command", cmdtext, true, 10) == 0)
{
if(PlayerTeam[playerid] == TEAM1) {
//code here
}
else if(PlayerTeam[playerid] == TEAM2) {
SendClientMessage(playerid,COLOR_WHITE,"SERVER: "COL_RED"You are not TEAM1 to use this command");
return 1;
}
return 1;
}
Re: How to make a command for a certain team only -
Rabbayazza - 13.08.2011
just at the top
Re: How to make a command for a certain team only -
Rabbayazza - 13.08.2011
Код:
if (strcmp("/enter", cmdtext, true) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 1469.3627,-1010.8922,26.8438))
{
SetPlayerPos(playerid, 246.2732,112.0255,1003.2188);
SetPlayerInterior(playerid, 10);
}
if(PlayerTeam[playerid] == TEAM_POLICE) {
if(IsPlayerInRangeOfPoint(playerid, 2.0, 239.9734,117.2457,1003.2257))
{
SetPlayerPos(playerid, 237.9738,117.6887,1003.2188);
}
}
else if(PlayerTeam[playerid] == TEAM_GROVE) {
SendClientMessage(playerid,COLOR_WHITE,"SERVER: You have to be in the Police Force to enter here.");
return 1;
}
return 1;
}
The first /enter should be available to everyone.
Код:
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(164) : error 017: undefined symbol "PlayerTeam"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(164) : warning 215: expression has no effect
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(164) : error 001: expected token: ";", but found "]"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(164) : error 029: invalid expression, assumed zero
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(164) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
if(PlayerTeam[playerid] == TEAM_POLICE) {
< line 164
Re: How to make a command for a certain team only -
[MG]Dimi - 13.08.2011
new PlayerTeam[MAX_LYERSap];// at the top of your script.
public OnPlayerSpawn(playerid)
{
PlayerInfo[playerid] = TEAM_POLICE;
Re: How to make a command for a certain team only -
Rabbayazza - 13.08.2011
Код:
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(49) : error 017: undefined symbol "MAX_LYERSap"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(49) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(190) : warning 209: function "OnPlayerCommandText" should return a value
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(192) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(194) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(199) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(203) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(207) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(211) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(215) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(218) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 017: undefined symbol "PlayerInfo"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : warning 215: expression has no effect
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 001: expected token: ";", but found "]"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 029: invalid expression, assumed zero
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Re: How to make a command for a certain team only -
[MG]Dimi - 13.08.2011
My keyboard failed, it should be new PlayerTeam[MAX_PLAYERS];
Re: How to make a command for a certain team only -
Rabbayazza - 13.08.2011
Код:
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(190) : warning 209: function "OnPlayerCommandText" should return a value
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(192) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(194) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(199) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(203) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(207) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(211) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(215) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(218) : error 010: invalid function or declaration
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 017: undefined symbol "PlayerInfo"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : warning 215: expression has no effect
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 001: expected token: ";", but found "]"
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : error 029: invalid expression, assumed zero
C:\Users\System user\Desktop\Server\gamemodes\Robert.pwn(226) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
12 Errors.
Now O_O
Re: How to make a command for a certain team only -
Kingunit - 13.08.2011
You forget to return OnPlayerCommandText