I WRITE A COMMAND AND SERVER CRASHES! *REP+*
#1

Hey guys, i need help. I have this kick command, which is kicking player from the server, but when i type and send this command, the server crashes. I tried to print whole command, and you will be enable to see by bold last line, which was sended, the rest was not.

Код:
CMD:tkick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_RED, "Zadanэ prнkaz neexistuje");
	new tid,du,res[150],ppp[50];
	if(sscanf(params,"uis[150]",tid,du,res) || isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Pouћitie: /tkick <id> <počet minъt 1-59> <dфvod>");
	if(!IsPlayerConnected(tid)) return SendClientMessage(playerid, COLOR_RED, "Hrбč nieje pripojenэ");
	if(PlayerInfo[tid][pAdmin] > 1) return SendClientMessage(playerid, COLOR_RED, "Nemфћete vyhodiť člena admin tэmu");
	new banmt[300],banma[300],adminname[MAX_PLAYER_NAME],targetn[MAX_PLAYER_NAME];
	GetPlayerName(playerid,adminname,sizeof(adminname));
	new exp=gettime()+(60*du);
	GetPlayerIp(tid,ppp,sizeof(ppp));
	new INI:File = INI_Open(UserBanPath(tid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Banexp",exp);
	INI_WriteInt(File,"BanPerm",0);
	INI_WriteString(File,"BanAdmin",adminname);
	INI_WriteString(File,"Reason",res);
	INI_WriteString(File,"IP",ppp);
	INI_Close(File);
	GetPlayerName(tid,targetn,sizeof(targetn));
	new INI:iFile = INI_Open(UserIPPath(tid));
	INI_SetTag(iFile,"data");
	INI_WriteInt(iFile,"Banexp",exp);
	INI_WriteInt(iFile,"BanPerm",0);
	INI_WriteString(iFile,"BanPlayer",targetn);
	INI_WriteString(iFile,"BanAdmin",adminname);
	INI_WriteString(iFile,"Reason",res);
	INI_Close(iFile);
	new File:logg=fopen("BannedPlayers.txt",io_append);
	fwrite(logg, targetn);
	fwrite(logg,"\n");
	fclose(logg);
	switch(PlayerInfo[playerid][pAdmin])
	{
	    case 2:
	    {
			format(banma,sizeof(banma),"Moderбtor %s vyhodil hrбča %s na %d minъt z dфvodu: %s",adminname,targetn,du,res);
			format(banmt,sizeof(banmt),"Moderбtor %s vбs vyhodil na %d minъt: %s",adminname,du,res);
		}
	    case 3:
	    {
			format(banma,sizeof(banma),"Administrбtor %s vyhodil hrбča %s na %d minъt z dфvodu: %s",adminname,targetn,du,res);
			format(banmt,sizeof(banmt),"Boli ste vyhodenэ Administrбtorom %s na %d minъt z dфvodu: %s",adminname,du,res);
		}
	    case 4:
	    {
			format(banma,sizeof(banma),"Vedъci Administrбtor %s vyhodil hrбča %s na %d minъt z dфvodu: %s",adminname,targetn,du,res);
			format(banmt,sizeof(banmt),"Boli ste vyhodenэ Vedъcim Administrбtorom %s na %d minъt z dфvodu: %s",adminname,du,res);
		}
	    case 5:
	    {
			format(banma,sizeof(banma),"Hlavnэ Administrбtor %s vyhodil hrбča %s na %d minъt z dфvodu: %s",adminname,targetn,du,res);
			format(banmt,sizeof(banmt),"Boli ste vyhodenэ Hlavnэm Administrбtorom %s na %d minъt z dфvodu: %s",adminname,du,res);
		}
	}
	SendClientMessageToAll(COLOR_RED,banma);
	SendClientMessage(tid,COLOR_RED,banmt);
	SetTimerEx("KickPlayer",100,false,"i",tid);
	return 1;
}
If anyone would be enable to help me, i would give him a rep+.
Reply
#2

Please show us the code of this function UserBanPath(tid)
Reply
#3

Here you go:

Код:
stock UserBanPath(playerid)
{
	new string[128],playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	format(string,sizeof(string),BANPATH,playername);
	return string;
}
EDIT:

Definition of BANPATH:

Код:
#define BANPATH "/Bans/%s.ini"
Reply
#4

Install crashdetect plugin, and show us log.
Reply
#5

Here:

Код:
[17:20:06] [debug] Server crashed while executing jb.amx
[17:20:06] [debug] AMX backtrace:
[17:20:06] [debug] #0 00000035 in ?? (54, 0, 17724684) from jb.amx
[17:20:06] [debug] #1 0000e83c in ?? (54, 0, 1458145506, 0, 1458145506, 0, 0, 0, 0, 0, ... <2 arguments>) from jb.amx
[17:20:06] [debug] #2 00000035 in public cmd_tkick () from jb.amx
[17:20:06] [debug] #3 native CallLocalFunction () from samp03svr
[17:20:06] [debug] #4 000005a0 in public OnPlayerCommandText (1, 17711976) from jb.amx
Reply
#6

To see full logs follow this:
http://forum.sa-mp.com/showpost.php?...32&postcount=7
Reply
#7

Well, but that thread does not work for me.
Reply
#8

Create pawn.cfg in your pawno folder, and write inside: -d3
Reply
#9

Fine, and than i just compile it with that crashdetect.inc?
Reply
#10

check that whether there is a folder named "Bans" in scriptfiles folder
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)