PDA

View Full Version : help with setplayerteam


jaami
21/02/2011, 11:27 AM
can any help me i make the scripts but when inside the server its say unknow command
and i make setleader so the leader can setcop
#include <a_samp>

// Define the teams so its easier to use later
#define TEAM_BLUE 0
#define LEADER_BLUE 1
#define SetPlayerTeam
#define IsPlayergTeam

// Define the colours you want each team to be, its easier for later on
#define TEAM_BLUE_COLOUR 0x0000BBAA // blue duh
#define LEADER_BLUE_COLOUR 0x0000BBAA
#define orange 0xFF9900AA


// Tracks what team a player is in
new gTeam[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Cops scripts");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

public OnPlayerRequestClass(playerid, classid)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/setleader", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid, 0x0000FFAA);
SendClientMessage(playerid, orange,"You have set this player to Chief of cops.");
}
else
{
SendClientMessage(playerid, orange, " you are not authorized to use that command!");
}
return 1;
}
//-----------------[setcop]--------------------------

if (strcmp("/setcop", cmdtext, true, 10) == 0)
{
if(gTeam[playerid] == LEADER_BLUE)
{
SetPlayerTeam(playerid, 0);
SetPlayerColor(playerid, 0x0000FFAA);
SendClientMessage(playerid, orange,"You have set this player to cop.");
}
else
{
SendClientMessage(playerid, orange, " you are not authorized to use that command!");
}
return 1;
}
return 0;
}

Devilxz97
12/05/2012, 03:02 PM
}
return 1;
}
return 0;
}

change the return 0; to return 1;

Faisal_khan
12/05/2012, 03:24 PM
Here you made a mistake:if (strcmp("/setcop", cmdtext, true, 6) == 0) the no. 6 here is the no. of letters in your command (i.e. setcop). This mistake is same in the above case.

And here is your gm:#include <a_samp>

// Define the teams so its easier to use later
#define TEAM_BLUE 2
#define LEADER_BLUE 3
#define SetPlayerTeam
#define IsPlayergTeam

// Define the colours you want each team to be, its easier for later on
#define TEAM_BLUE_COLOUR 0x0000BBAA // blue duh
#define LEADER_BLUE_COLOUR 0x0000BBAA
#define orange 0xFF9900AA

// Tracks what team a player is in
new gTeam[MAX_PLAYERS];

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Cops scripts");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
return 1;
}


public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/setleader", cmdtext, true, 9) == 0)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerTeam(playerid, 2);
SetPlayerColor(playerid, 0x0000FFAA);
SendClientMessage(playerid, orange,"You have set this player to Chief of cops.");
}
else
{
SendClientMessage(playerid, orange, " you are not authorized to use that command!");
}
return 1;
}
//-----------------[setcop]--------------------------

if (strcmp("/setcop", cmdtext, true, 6) == 0)
{
if(gTeam[playerid] == LEADER_BLUE)
{
SetPlayerTeam(playerid, 3);
SetPlayerColor(playerid, 0x0000FFAA);
SendClientMessage(playerid, orange,"You have set this player to cop.");
}
else
{
SendClientMessage(playerid, orange, " you are not authorized to use that command!");
}
return 1;
}
return 0;
}