Tag problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Tag problem (
/showthread.php?tid=440540)
Tag problem -
DetoNater - 30.05.2013
I don't have any errors/warnings, I have some problem, I changed my name to [KZ] clan tag, but when i quit and i join I am kicked.
pawn Код:
new stringtag[128]; //if the name contains [KZ] tag...
if (PlayerInfo[playerid][pTag] == 0)
{
if(strfind(Name(playerid), "[KZ]", true) != -1)
{
{
format(stringtag, sizeof(stringtag), "%s has been kicked from the Server [Reason: Unauthorized Tag]", Name(playerid));
SendClientMessageToAll(C_LBLUE, stringtag);
DelayKick(playerid, 100);
}
}
}
please guide me to fix the problem, thanks in advace.
Re: Tag problem -
IceBilizard - 30.05.2013
pawn Код:
new name[24]; // Makes a new string for the name
GetPlayerName(playerid,name,sizeof(name)); // Assigns it to the name
if(strfind(name,"[KZ]",true) != -1) // The != is if it was found.
{
if (PlayerInfo[playerid][pTag] != 1)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "** You are not in [KG] clan. Result is kick from the server **");
Kick(playerid);
return 1;
}
}
Re: Tag problem -
DetoNater - 30.05.2013
Quote:
Originally Posted by IceBilizard
pawn Код:
new name[24]; // Makes a new string for the name GetPlayerName(playerid,name,sizeof(name)); // Assigns it to the name if(strfind(name,"[KZ]",true) != -1) // The != is if it was found. { SendClientMessage(playerid, COLOR_LIGHTRED, "** You are not in [KG] clan. Result is kick from the server **"); Kick(playerid); return 1; } }
|
but i am in KZ clan dude, and see in,
pawn Код:
if (PlayerInfo[playerid][pTag] == 0)
if the value is 0 only it kicks, but my stats is in database is Tag = 1
Re: Tag problem -
IceBilizard - 30.05.2013
added
pawn Код:
if (PlayerInfo[playerid][pTag] != 1)// must have 1
Re: Tag problem -
DetoNater - 30.05.2013
does'nt work ice.
Re: Tag problem -
IceBilizard - 30.05.2013
Where you using this code?
use this code under onplayerspawn i am using this working perfect
Re: Tag problem -
DetoNater - 30.05.2013
no i place it on OnPlayerConnect.
Re: Tag problem -
GiamPy. - 30.05.2013
Strfind returns -1 when the needle (the word searched) is
NOT found. In this case, you inverted the checks.
pawn Код:
new stringtag[128];
if(PlayerInfo[playerid][pTag] == 0) // The server found the player is not part of the clan. Has they got the tag into their name?
{
if(strfind(Name(playerid), "[KZ]", true) > -1) // If the server does not find the tag, strfind returns -1. That means the following code is not executed.
{
format(stringtag, sizeof(stringtag), "%s has been kicked from the Server [Reason: Unauthorized Tag]", Name(playerid));
SendClientMessageToAll(C_LBLUE, stringtag);
DelayKick(playerid, 100);
}
}
Re: Tag problem -
IceBilizard - 30.05.2013
Quote:
Originally Posted by DetoNater
no i place it on OnPlayerConnect.
|
Place under Onplayerspawn
Re: Tag problem -
DetoNater - 30.05.2013
Quote:
Originally Posted by GiamPy.
Strfind returns -1 when the needle (the word searched) is NOT found. In this case, you inverted the checks.
pawn Код:
new stringtag[128];
if(PlayerInfo[playerid][pTag] == 0) // The server found the player is not part of the clan. Has they got the tag into their name? { if(strfind(Name(playerid), "[KZ]", true) > -1) // If the server does not find the tag, strfind returns -1. That means the following code is not executed. { format(stringtag, sizeof(stringtag), "%s has been kicked from the Server [Reason: Unauthorized Tag]", Name(playerid)); SendClientMessageToAll(C_LBLUE, stringtag); DelayKick(playerid, 100); } }
|
sorry dude, dint work. by the way,
pawn Код:
if(PlayerInfo[playerid][pTag] == 0)//the player is not in the clan!