Kurze frage : Wie kann ich es machen das eine nachricht nur zu einem team geschickt wird?
Willi
Kurze frage : Wie kann ich es machen das eine nachricht nur zu einem team geschickt wird?
Willi
enum P_TEAM { SWAT, SUSPECTS };
new P_TEAM:pTeam[MAX_PLAYERS];
/* ... */
if(text[0] == '!')
{
 SendTeamMessage(text, pTeam[playerid]);
 return 0;
}
/* ... */
stock SendTeamMessage(arg1[], P_TEAM:arg2)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
 {
  if(pTeam[i] == arg2)
  SendClientMessage(i, 0xFF6900AA, arg1);
 }
}
Bei mir kommt:
E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(36) : error 010: invalid function or declaration
E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(39) : error 010: invalid function or declaration
E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(42) : error 025: function heading differs from prototype
Ok..
Aber iwi kann ich des ned^^
#include <a_samp>
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
#else
main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}
#endif
public OnPlayerText(playerid, text[])
{
 if(text[0] == '!')
{
 SendTeamMessage(text, pTeam[playerid]);
 return 0;
}
/* ... */
stock SendTeamMessage(arg1[], P_TEAM:arg2)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
 {
  if(pTeam[i] == arg2)
  SendClientMessage(i, 0xFF6900AA, arg1);
 }
}
}
Sry aber ich bin noch Anfänger im scripten^^
Du hast die beiden neuen sachen vergessen, die das new beinhalten.
#include <a_samp>
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#if defined FILTERSCRIPT
enum P_TEAM { SWAT, SUSPECTS }; //Das hier
new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
public OnPlayerText(playerid, text[])
{
 if(text[0] == '!')
{
 SendTeamMessage(text, pTeam[playerid]);
 return 0;
}
stock SendTeamMessage(arg1[], P_TEAM:arg2)
{
 for(new i = 0; i < MAX_PLAYERS; i++)
 {
  if(pTeam[i] == arg2)
  SendClientMessage(i, 0xFF6900AA, arg1);
 }
}
}
Aber wenn ich bei mir jetzt ! test mache kommt da in Orange der Text, aber jeder kann ihn lesen, und die Teams hab ich schon geändert, die hier stehen : enum P_TEAM { DEALER, KELLNER2, SKYDIVE };
Ja genau.
Und wie stelle ich ein wer im team ist??
bei dem hier :
enum P_TEAM { SWAT, SUSPECTS };
Bei mir ist das so eingetragen :
enum P_TEAM { DEALER, KELLNER2, SKYDIVE };
Aber wenn ich dann ! test mache, kann das irgendwie jeder lesen...
Jo du musst auch vorher den Spieler in ein Team setzten ![]()
pTeam[playerid] = DEALER; z.B.
Ok
Bei mir funzt da gar nichts..
DMA?
kannst du mal pls den ganzen script posten??
#include <a_samp>
enum P_TEAM { SWAT, SUSPECTS }; //Das hier
new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
public OnPlayerConnect(playerid)
{
	/* Hier wird per Zufall ein Spieler Team ausgewählt! */
	new _rand = random(2);
	if(_rand == 0)
		pTeam[playerid] = SWAT;
	else if(_rand == 1)
		pTeam[playerid] = SUSPECTS;
}
public OnPlayerText(playerid, text[])
{
 	if(text[0] == '!')
	{
 		SendTeamMessage(text, pTeam[playerid]);
 		return 0;
	}
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp("/swat", cmdtext))
	{
		SendClientMessage(playerid, 0xFF0000AA, "Du bist nun SWAT!");
		pTeam[playerid] = SWAT;
	}
	if(!strcmp("/suspect", cmdtext))
	{
		SendClientMessage(playerid, 0xFF0000AA, "Du bist nun böse ;)");
		pTeam[playerid] = SUSPECTS;
	}
}
stock SendTeamMessage(arg1[], P_TEAM:arg2)
{
 	for(new i = 0; i < MAX_PLAYERS; i++)
 	{
  		if(pTeam[i] == arg2)
  		SendClientMessage(i, 0xFF6900AA, arg1);
 	}
}
Ok thx es kommt nur noch 1 Warnung.
E:\Programme\Rockstar Games\Grand Theft Auto San Andreas\Server\filterscripts\text.pwn(3 : warning 209: function "OnPlayerText" should return a value
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Bugfix:
#include <a_samp>
enum P_TEAM { SWAT, SUSPECTS }; //Das hier
new P_TEAM:pTeam[MAX_PLAYERS]; // Und das hier
public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}
public OnFilterScriptExit()
{
	return 1;
}
public OnPlayerConnect(playerid)
{
	/* Hier wird per Zufall ein Spieler Team ausgewählt! */
	new _rand = random(2);
	if(_rand == 0)
		pTeam[playerid] = SWAT;
	else if(_rand == 1)
		pTeam[playerid] = SUSPECTS;
}
public OnPlayerText(playerid, text[])
{
 	if(text[0] == '!')
	{
 		SendTeamMessage(text, pTeam[playerid]);
 		return 0;
	}
       return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp("/swat", cmdtext))
	{
		SendClientMessage(playerid, 0xFF0000AA, "Du bist nun SWAT!");
		pTeam[playerid] = SWAT;
               return 1;
	}
	if(!strcmp("/suspect", cmdtext))
	{
		SendClientMessage(playerid, 0xFF0000AA, "Du bist nun böse ;)");
		pTeam[playerid] = SUSPECTS;
               return 1;
	}
       return 0;
}
stock SendTeamMessage(arg1[], P_TEAM:arg2)
{
 	for(new i = 0; i < MAX_PLAYERS; i++)
 	{
  		if(pTeam[i] == arg2)
  		SendClientMessage(i, 0xFF6900AA, arg1);
 	}
}