Need help with this. - 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: Need help with this. (
/showthread.php?tid=455000)
Need help with this. -
ACI - 31.07.2013
Hello. I got a problem. At OnPlayerConnect, the server gets the player's name and stores the string in the variable 'Gpd', It now opens the file 'PK_List.txt' and searches for the string line-by-line. If the player's name exists in the file, it kicks the player. The problem I am having is that the server too kicks players which are not in the list. What to do?
pawn Код:
public OnPlayerConnect(playerid)
{
new Gpd[MAX_PLAYER_NAME], str[64];
GetPlayerName(playerid, Gpd, sizeof Gpd);
new File:wtf = fopen("PK_List.txt", io_read);
while(fread(wtf, Gpd))
{
if(strcmp(str, Gpd, true) == 0)
{
SendClientMessage(playerid, -1, "This player is killed in the war. This player cant be playable. Chage your name to something else.");
SetTimer("__Kick", 80, false);
}
}
fclose(wtf);
return 1;
}
Re: Need help with this. -
dEcooR - 31.07.2013
Hmm try to use strfind..
Код:
if(strfind(str,Gpd) != -1)
or just change your to this
Код:
if(strcmp(str, Gpd, false) == 0)