PDA

View Full Version : Tag problem


DetoNater
30/05/2013, 09:36 AM
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.


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.

IceBilizard
30/05/2013, 09:43 AM
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;
}
}

DetoNater
30/05/2013, 09:48 AM
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, if (PlayerInfo[playerid][pTag] == 0) if the value is 0 only it kicks, but my stats is in database is Tag = 1

IceBilizard
30/05/2013, 09:49 AM
added


if (PlayerInfo[playerid][pTag] != 1)// must have 1

DetoNater
30/05/2013, 10:06 AM
does'nt work ice.

IceBilizard
30/05/2013, 10:11 AM
Where you using this code?
use this code under onplayerspawn i am using this working perfect

DetoNater
30/05/2013, 11:38 AM
no i place it on OnPlayerConnect.

GiamPy.
30/05/2013, 11:44 AM
Strfind (http://wiki.sa-mp.com/wiki/Strfind) returns -1 when the needle (the word searched) is NOT found. In this case, you inverted the checks.

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);
}
}

IceBilizard
30/05/2013, 11:58 AM
no i place it on OnPlayerConnect.


Place under Onplayerspawn

DetoNater
30/05/2013, 02:43 PM
Strfind (http://wiki.sa-mp.com/wiki/Strfind) returns -1 when the needle (the word searched) is NOT found. In this case, you inverted the checks.

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, if(PlayerInfo[playerid][pTag] == 0)//the player is not in the clan!

[ABK]Antonio
30/05/2013, 02:46 PM
What are you expecting it to do?

Konstantinos
30/05/2013, 03:15 PM
Everytime you connect, PlayerInfo[playerid][pTag] will be 0. You've to load the stuff from the database and then check if the pTag is 0 or 1 and go on with the searching!

DetoNater
30/05/2013, 06:33 PM
Antonio;2548115']What are you expecting it to do?

I want that if a player is given a tag by admin, the Ptag will be set to 1, and when he relogs he can join normally, but if an unauthorized player joins with a tag he should be kicked.

Everytime you connect, PlayerInfo[playerid][pTag] will be 0. You've to load the stuff from the database and then check if the pTag is 0 or 1 and go on with the searching!

no dude, when i login the mysql fetches column from Tag and i get the value 1

Konstantinos
30/05/2013, 06:38 PM
no dude, when i login the mysql fetches column from Tag and i get the value 1

Think what you said, you get the value 1 when you login and your code kicks you when you connect. Large difference.