Clan Tags scripting help
#1

I got some of the script but it does not work

what i want it to do is when you connect with the right clan tag say it is [WDM] and your name is [WDM]Jonny and your name would be in blue and if you connected with out a tag say Bob your name would be any colour but blue and what the other clan name colours are.

Here Want I need
people with the clan tag [WDM] are in Blue there names might be [WDM]Jonny and [WDM]bob
people with the clan tag [Vagos] are in Green there names might be [Vagos]fred and [Vagos]Josh

Here's the script it i got
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT

#include <a_samp>

	stock HasClanTag(playerid,const clantag[])
	{
	new clan_tag[10],lname[MAX_PLAYER_NAME];
	GetPlayerName(playerid,lname,sizeof lname);
	format(clan_tag,strlen(clantag)+2,"[%s]",clantag);
	return (strfind(lname,clan_tag)!=-1) ? (true) : (false);
	}


public OnGameModeInit()
{
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	if(HasClanTag(playerid,"[WDM]"))SetPlayerColor(playerid,0x00F2C8FF);
}
Reply
#2

Код:
 new IsPlayerWDMMember[MAX_PLAYERS];


Код:
	if(strfind(playername, "[RRP]", true) == -1){ // DETECT A WDM MEMBER
	}else{
	//new string[256];
	GetPlayerName(playerid,playername,sizeof(playername));
	SendClientMessage(playerid, COLOR_WHITE, "Welcome [WDM] member.");
	IsPlayerWDMMember[playerid]=1;
	}
Hope that helped!
Reply
#3

Quote:
Originally Posted by [LSR
State_Trooper ]
Код:
 new IsPlayerWDMMember[MAX_PLAYERS];
Why make a useless variable while you could just check it with strfind again?
Each cell takes 4 bytes, MAX_PLAYERS is 500, so 4*500 = 2000, 2 kilobytes are wasted for nothing.
Reply
#4

Quote:
Originally Posted by SpiderPork
Quote:
Originally Posted by [LSR
State_Trooper ]
Код:
 new IsPlayerWDMMember[MAX_PLAYERS];
Why make a useless variable while you could just check it with strfind again?
Each cell takes 4 bytes, MAX_PLAYERS is 500, so 4*500 = 2000, 2 kilobytes are wasted for nothing.
Ohh well... Im sure you will live
Reply
#5

Quote:
Originally Posted by [LSR
State_Trooper ]
Quote:
Originally Posted by SpiderPork
Quote:
Originally Posted by [LSR
State_Trooper ]
Код:
 new IsPlayerWDMMember[MAX_PLAYERS];
Why make a useless variable while you could just check it with strfind again?
Each cell takes 4 bytes, MAX_PLAYERS is 500, so 4*500 = 2000, 2 kilobytes are wasted for nothing.
Ohh well... Im sure you will live
You will, but it's still better to not waste so many space. Imagine having more of similar variables; nightmare. When coding, try to make the code as efficient as possible .
Reply
#6

Quote:
Originally Posted by [LSR
State_Trooper ]
Код:
 new IsPlayerWDMMember[MAX_PLAYERS];


Код:
	if(strfind(playername, "[RRP]", true) == -1){ // DETECT A WDM MEMBER
	}else{
	//new string[256];
	GetPlayerName(playerid,playername,sizeof(playername));
	SendClientMessage(playerid, COLOR_WHITE, "Welcome [WDM] member.");
	IsPlayerWDMMember[playerid]=1;
	}
Hope that helped!
where do i put this
Reply
#7

Onplayerconnect
Reply
#8

will i still need to top bit under the incs
Reply
#9

Jonny, At the top of your script you will se a whole lot of new's, Here is an example.

Код:
new Count=5;
new VulnerableToDrugs[MAX_PLAYERS];
new VulnerableToDrugsTimer;
They should be under the #define what ever;

Put this with all the new's
Код:
new IsPlayerWDMMember[MAX_PLAYERS];
Then this Under public OnPlayerConnect(playerid)


Код:
	if(strfind(playername, "[RRP]", true) == -1){ // DETECT A WDM MEMBER
	}else{
	//new string[256];
	GetPlayerName(playerid,playername,sizeof(playername));
	SendClientMessage(playerid, COLOR_WHITE, "Welcome [WDM] member.");
	IsPlayerWDMMember[playerid]=1;
	}



Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)