Server crash
#1

Hello guys, I started a couple of weeks to use YCMD.

But i get some weird crash when I use a command (sometime) and the line i think are not the ones that need to be.

So I have some command in my gamemode like this: https://pastebin.com/LfYq2d2G

And other like this: https://pastebin.com/TBtJhSRA

CMD and YCMD, that's the point.

Server_Log with crash:

https://pastebin.com/L5Dj8Di2

lines: https://pastebin.com/1ZqhDxj1 (CTRL+F and search //THIS IS THE LINE)
there are two cmd because there are to crash in server_log as you can see

I think it's like I use both of them, for a command
ex: CMD:command(playerid, params[] and YCMD:command(playerid, params[], help)


or it can be because i didn't have the latest YSI libraries? (4.0.2) ?

Can someone help me?
Reply
#2

PHP код:
[22:42:07] [debug#0 native format () from samp03svr
[22:42:07] [debug#1 00259a4c in public OnPlayerCommandText () at D:\gamemode\gamemodes\exgaming.pwn:35215 
can you show the line 35215? [ the range of it +10 lines above and +10 line below it too. ]
Reply
#3

Код:
CMD:block(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pPhone] == 1)
		{
			new id,string[128],string2[128],name[30];
			if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_USAGE, "Usage:{FFFFFF} /block [name/playerid]");
			if(IsPlayerConnected(id))
			{
				if(PlayerInfo[playerid][pPhoneBlocked][id] == 1) return SS(playerid, COLOR_LGREEN, "Acest user este deja blocat.", "That user is already blocked.");
				PlayerInfo[playerid][pPhoneBlocked][id] = 1;
				GetPlayerName(id, name, sizeof(name));
				format(string, sizeof(string), "Userul %s a fost blocat. Nu te va putea contacta prin telefon pana la urmatorul relog.", name);
				format(string2, sizeof(string2), "User %s has been temporary blocked. He won't be able to call/sms you until you reconnect to the server.", name);
				SS(playerid, COLOR_NICE, string, string2);
			}
			else return SendClientMessage(playerid, COLOR_GREY, "Player not connected.");
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "You don't have an iPhone.");
	}
	return 1;
}
CMD:unblock(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(IsPlayerConnected(playerid))
	{
		if(PlayerInfo[playerid][pPhone] == 1) // LINE 35215
		{
			new id,string[128],string2[128],name[30];
			if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_USAGE, "Usage:{FFFFFF} /unblock [name/playerid]");
			if(IsPlayerConnected(id))
			{
				if(PlayerInfo[playerid][pPhoneBlocked][id] == 0) return SS(playerid, COLOR_LGREEN, "Acest user nu este blocat.", "That user is not blocked!");
				PlayerInfo[playerid][pPhoneBlocked][id] = 0;
				GetPlayerName(id, name, sizeof(name));
				format(string, sizeof(string), "Userul %s a fost deblocat.", name);
				format(string2, sizeof(string2), "User %s has been unblocked.", name);
				SS(playerid, COLOR_NICE, string, string2);
			}
			else return SendClientMessage(playerid, COLOR_GREY, "Player not connected.");
		}
		else return SendClientMessage(playerid, COLOR_WHITE, "You don't have an iPhone.");
	}
	return 1;
}
CMD:call(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(IsPlayerConnected(playerid))
	{
		new number,sendername[30],string[256],giveplayer[25];
		if(sscanf(params, "i",number)) return SendClientMessage(playerid, COLOR_USAGE, "Usage:{FFFFFF} /call [number]");
		if(PlayerInfo[playerid][pPnumber] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You don't have a phone.");
		if(PhoneOnline[playerid] > 0) return SCM(playerid, COLOR_WHITE, "You must switch your phone on first (/turn on).");
		if(PlayerInfo[playerid][pCredits] < 2) return SCM(playerid, COLOR_GREY, "You have no remaining phone credit - visit a 24/7 to top it up.");
		if(PlayerInfo[playerid][pSleeping] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You are sleeping.");
		GetPlayerName(playerid, sendername, sizeof(sendername));
		if(number == 112 || number == 911)
		{
		    if(IsACop(playerid) && OnDuty[playerid] == 1) return SCM(playerid,COLOR_LGREEN,"You are a on duty cop.");
    	    if(WantedReason[playerid] != -1)
    	    {
    	    	if(!IsPlayerConnected(WantedName[playerid]) || !gPlayerLogged[playerid]) return SCM(playerid, -1, "You can't report the last crime did on you anymore.");
    	    	if(PlayerInfo[WantedName[playerid]][pJailed] > 0) return SCM(playerid, COLOR_WHITE, "This player is already in jail.");
    	        
    	        new killerid = WantedName[playerid];
				SCM(playerid, COLOR_GENANNOUNCE, "This player has wanted now. Thank you for reporting the crime.");

				if(WantedReason[playerid] == 0) addWantedPlayer(killerid, playerid, 1, "first degree murder");
				else if(WantedReason[playerid] == 1) addWantedPlayer(killerid, playerid, 1, "hit and run");

				addToAchievements(killerid, 31);
				ClearWanted(playerid);
				return 1;
		    }
			else
			{
				if(Mobile[playerid] == -1)
				{
					SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
					Mobile[playerid] = -2;
					SendClientMessage(playerid, COLOR_WHITE, "You've called Emergency services, please select the department you desire (i.e: SFPD, LSFMD).");
					if(PlayerInfo[playerid][pPhone] == 0)
					{
						SetPlayerAttachedObject(playerid,4,330,6, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
					}
					else if(PlayerInfo[playerid][pPhone] == 1)
					{
						SetPlayerAttachedObject(playerid, 4, 18865, 6, 0.086043, 0.027719, 0.003817, 95.232246, 178.651031, 1.691840, 1.002077, 1.000000, 1.000000 ); // MobilePhone1 - phone1
					}
				}
				return 1;
			}
		}
		if(number == PlayerInfo[playerid][pPnumber]) return SendClientMessage(playerid, COLOR_GRAD2, "You can't call yourself.");
		if(Mobile[playerid] != -1) return SendClientMessage(playerid, COLOR_WHITE, "You are currently in a call.");
		foreach(new i : Player)
		{
			if(IsPlayerConnected(i))
			{
				if(PlayerInfo[i][pPnumber] == number && number != 0)
				{
					new giveplayerid = i;
					if(IsPlayerConnected(giveplayerid))
					{
						if(giveplayerid != INVALID_PLAYER_ID)
						{
						    if(PhoneOnline[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_WHITE, "That player phone is offline.");
							if(PhoneOnlineCalls[giveplayerid] > 0) return SendClientMessage(playerid, COLOR_WHITE, "That player phone is offline for calls.");
							if(PlayerInfo[giveplayerid][pPhoneBlocked][playerid] == 1) return SS(playerid, COLOR_LGREEN, "Playerul pe care incerci sa-l suni ti-a blocat numarul de telefon.", "The player you are trying to call has blocked your number. You can't contact him/her.");
							if (Mobile[giveplayerid] == -1)
							{
								Mobile[playerid] = giveplayerid;
								if(PlayerInfo[playerid][pPhone] == 0)
								{
									format(string, sizeof(string), "* %s takes out their cellphone, and dials in a number.", sendername);
								}
								else if(PlayerInfo[playerid][pPhone] == 1)
								{
									format(string, sizeof(string), "* %s takes out their iPhone, and dials in a number.", sendername);
								}
								ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
								PlayerPlaySound(playerid, 3600, 0.0, 0.0, 0.0);
								PlayerPlaySound(giveplayerid, 20600, 0.0, 0.0, 0.0);
								format(string, sizeof(string), "%s is calling you. Use /p(ickup) to answer your phone.", sendername);
								SendClientMessage(giveplayerid, COLOR_YELLOW, string);
								GetPlayerName(giveplayerid,giveplayer,sizeof(giveplayer));
								if(PlayerInfo[playerid][pPhone] == 0)
								{
									SetPlayerAttachedObject(playerid,4,330,6, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
								}
								else if(PlayerInfo[playerid][pPhone] == 1)
								{
									SetPlayerAttachedObject( playerid, 4, 18865, 6, 0.086043, 0.027719, 0.003817, 95.232246, 178.651031, 1.691840, 1.002077, 1.000000, 1.000000 ); // MobilePhone1 - phone1
								}
								if(PlayerInfo[giveplayerid][pPhone] == 0)
								{
									format(string, sizeof(string), "* %s's cellphone starts to ring...", giveplayer);
								}
								else if(PlayerInfo[giveplayerid][pPhone] == 1)
								{
									format(string, sizeof(string), "* %s's iPhone starts to ring...", giveplayer);
								}

								if(Spectate[giveplayerid] == -1) ProxDetector(20.0, giveplayerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

								CellTime[playerid] = 1;
								SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
								return 1;
							}
						}
					}
				}
			}
		}
		SendClientMessage(playerid, COLOR_GRAD2, "(cellphone) *busy tone*");
	}
	return 1;
}

YCMD:sms(playerid, params[], help)
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(IsPlayerConnected(playerid))
	{
		new phonenumb,smstext[90],sendername[30],giveplayer[30],string[256],string2[184];
	    if(PlayerInfo[playerid][pMuted] == 1)
	    {
			if(PlayerInfo[playerid][pLanguage] == 2) format(string, sizeof(string), "Nu poti scrie pe chat momentan(mute). Vei putea scrie pe chat peste %d secunde.",PlayerInfo[playerid][pMuteTime]);
			else format(string, sizeof(string), "You are now muted! You will be able to talk again in %d seconds.",PlayerInfo[playerid][pMuteTime]);
			SendClientMessage(playerid, COLOR_NICE, string);
			return 1;
		}
		if(sscanf(params, "is[90]",phonenumb,smstext)) return SendClientMessage(playerid, COLOR_USAGE, "Usage:{FFFFFF} /sms [number] [text]");
		if(PlayerInfo[playerid][pPnumber] == 0) return SendClientMessage(playerid, COLOR_GREY, "You dont't have a phone.");
		if(PhoneOnline[playerid] > 0) return SCM(playerid, COLOR_GREY, "Your phone is not switched on.");
		if(PlayerInfo[playerid][pCredits] < 2) return SCM(playerid, COLOR_GREY, "You have no remaining phone credit - visit a 24/7 to top it up.");
		if(phonenumb == PlayerInfo[playerid][pPnumber]) return SCM(playerid, -1, "Nu-ti poti trimite SMS singur!");
		foreach(new i : Player)
		{
			if(PlayerInfo[i][pPnumber] == phonenumb && phonenumb != 0)
			{
			    if(PhoneOnline[i] > 0) return SendClientMessage(playerid, COLOR_GREY, "The cellphone that you're trying to SMS is currently unavailable.");
			    if(PlayerInfo[i][pPhoneBlocked][playerid] == 1) return SS(playerid, COLOR_LGREEN, "Playerul caruia incerci sa ii trimiti SMS ti-a blocat numarul de telefon.", "The player you are trying to text has blocked your number. You can't contact him/her.");
			    GetPlayerName(playerid, sendername, sizeof(sendername));
				if(PlayerInfo[i][pAdmin] < 1) format(string, sizeof(string), "SMS from %s (%d): %s", sendername, PlayerInfo[playerid][pPnumber], smstext);
				else format(string, sizeof(string), "SMS from %s (%d): %s", sendername, playerid, smstext);
				GetPlayerName(i, giveplayer, sizeof(giveplayer));
				format(string2, sizeof(string2), "SMS sent to %s (%d): %s", giveplayer, PlayerInfo[i][pPnumber], smstext);
				SendClientMessage(i,COLOR_YELLOW, string);
				SendClientMessage(playerid,COLOR_CYAN, string2);
				new var100[300],resulttt[300],strr[300];
				format(strr, sizeof(strr),"[SMS] %s to %s: %s", sendername, giveplayer, smstext);
				mysql_real_escape_string(strr, resulttt);
				mysql_format(SQL,var100, sizeof(var100), "INSERT INTO chat_logs (`playerid`,`text`,`where`) VALUES ('%d','%s','sms')", PlayerInfo[playerid][pSQLID], resulttt);
				mysql_tquery(SQL,var100,"","");
				PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
				PlayerPlaySound(i, 1139, 0.0, 0.0, 0.0);
				PlayerInfo[playerid][pCredits] = PlayerInfo[playerid][pCredits] - 2;
				LastPlayer[i] = playerid;
				foreach(new adm : Admins)
				{
    				if(BigEar[adm] == 1)
					{
    					format(string, sizeof(string), "{63969C}SMS from %s (%d) to %s (%d): %s",sendername,playerid,giveplayer,i,smstext);
						SendClientMessage(adm,  COLOR_WHITE, string);
					}
				}
				return 1;
			}
		}
		SendClientMessage(playerid, COLOR_GREY, "Invalid number.");
	}
	return 1;
}
Reply
#4

Now, i get another crash new from a different command. I think is because i use simultaneously on my gamemode CMD and YMCD (examples in first post).

server_log

https://pastebin.com/VxtnC48u

COMMAND with line 27490 (line is with red - scroll down):

Код:
CMD:spec(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	if(!PlayerInfo[playerid][pAdmin] && !PlayerInfo[playerid][pHelper]) return SCM(playerid, COLOR_RED, AdminOnly);
	if(InRaceArena[playerid] == 1) return SCM(playerid, COLOR_LGREEN, "Nu ai voie sa folosesti aceasta comanda atata timp cat esti in arena de curse!");
	if(Alive[playerid] == 0) return SCM(playerid, COLOR_LGREEN, "Wait...");
	new id, string[256], Float: health, manevra[126], bool:pizda;
	if(sscanf(params, "u", id)) return SCM(playerid, COLOR_GREY, "Syntax:{FFFFFF} /spec [playerid]");
	if(id == INVALID_PLAYER_ID || id == playerid) return SCM(playerid, COLOR_GREY, "The specified player is not connected, or has not authenticated.");
	if(GetPVarInt(id, "specme") > 0 && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You don't have permission to use /spec on this admin.");
	if(Spectate[id] != -1) return SendClientMessage(playerid, COLOR_GREY, "That player is on spectating someone else.");
	if(TutTime[id] >= 1) return SendClientMessage(playerid, COLOR_GREY, "This player is currently in the tutorial.");
	if(PlayerInfo[id][pAdmin] != 0 && PlayerInfo[playerid][pHelper] != 0) return SendClientMessage(playerid, COLOR_GREY, "You can't spectate an admin.");
	
	if(Spectate[playerid] == -1) {
		saveCurrentPosition(playerid);
	}

    Spectate[playerid] = id;

	foreach(new x : Reporturi) {
		if(Reports[x][reportValid] && Reports[x][reportPlayer] == id && (Reports[x][reportType] == r_type_stuck || Reports[x][reportType] == r_type_dm)) {
			AdaugaRaport(playerid, "Reports", 1);

			switch(Reports[x][reportType]) {
				case r_type_stuck: {
					format(string, sizeof(string), "Admin %s is now spectating %s (reported for being stuck).", GetName(playerid), GetName(id));
					ABroadCast(COLOR_INFO,string,1);
					format(manevra, 126, "%s is stuck.", GetName(id));
				}
				case r_type_dm: {
					format(string, sizeof(string), "Admin %s is now spectating %s (reported for deathmatch).", GetName(playerid), GetName(id));
					ABroadCast(COLOR_INFO,string,1);
					format(manevra, 126, "%s was reported for deathmatch by %s.", GetName(id), GetName(Reports[x][reportBy]));
				}
			}
			pizda = true;

			Reports[x][reportValid] = 0;
			Reports[x][reportBy] = INVALID_PLAYER_ID;
			Reports[x][reportPlayer] = INVALID_PLAYER_ID;
			Reports[x][reportType] = r_type_none;
			Reports[x][reportTime] = 0;
			format(Reports[x][reportText], 128, "-");
			new cur = x;
			Iter_SafeRemove(Reporturi, cur, x);
			break;
		}
	}

	foreach(new x : Cheateri) {
		if(Cheaters[x][cheatValid] && Cheaters[x][cheatCheater] == id && Cheaters[x][cheatScore] >= 1) {
			AdaugaRaport(playerid, "Reports", 1);

			format(string, sizeof(string), "Admin %s is now spectating %s (reported for cheats).", GetName(playerid), GetName(id));
			ABroadCast(COLOR_INFO,string,1);
			format(manevra, 126, "%s was reported for cheats by %s.", GetName(id), GetName(Cheaters[x][cheatPlayer]));
			pizda = true;

			Cheaters[x][cheatPlayer] = INVALID_PLAYER_ID;
			Cheaters[x][cheatCheater] = INVALID_PLAYER_ID;
			Cheaters[x][cheatValid] = 0;
			Cheaters[x][cheatType] = c_type_none;
			Cheaters[x][cheatTime] = 0;
			Cheaters[x][cheatScore] = 0;
			format(Cheaters[x][cheatText], 128, "-");
			new cur = x;
			Iter_SafeRemove(Cheateri, cur, x);
			break;
		}
	}

	if(pizda) {
		mysql_format(SQL, gString, sizeof(gString),"INSERT INTO report_logs (`playerid`,`adminid`,`problem`,`answer`,`time`) VALUES ('%d','%d','%e','/spec','%d')",PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],manevra,gettime()); // LINE
		mysql_tquery(SQL, gString, "", "");
	}

	new weap, am, are = 0,str33[128],wName[50];
	format(string, sizeof(string),"%s's weapons:",GetName(id));
	for(new is; is < 13; is++) {
		GetPlayerWeaponData(id, is, weap, am);
		if(weap >= 1 && am >= 1) {
			are = 1;
			GetWeaponNameEx(weap, wName, sizeof(wName));
			format(str33, sizeof(str33)," [%s - %d]",wName,am);
			strcat(string, str33);
		}
	}
	if(are == 1) {
		SendClientMessage(playerid, COLOR_GREY, string);
	}
	else if(are == 0) {
		new noweapon[156];
		format(noweapon, sizeof(noweapon), "%s doesn't have any weapons!", GetName(id));
		SendClientMessage(playerid, COLOR_GREY, noweapon);
	}

	GetPlayerHealth(Spectate[playerid], health);
	format(string, sizeof(string), "(%d) %s | Level: %d | Health: %.0f | AFK: %d | Duty: %d | Ping: %d", Spectate[playerid], GetName(id), PlayerInfo[Spectate[playerid]][pLevel], health, IsPlayerAFK[Spectate[playerid]], OnDuty[Spectate[playerid]], GetPlayerPing(Spectate[playerid]));
	SendClientMessage(playerid, COLOR_WHITE, string);
	TogglePlayerSpectating(playerid, 1);
	ShowDMG[playerid] = 1;

	if(EstiFondator(id)) SCMF(id, COLOR_WHITE, "* Admin %s is now spectating you.", GetName(playerid));

	if(IsPlayerInAnyVehicle(Spectate[playerid])) {
	    new carid = GetPlayerVehicleID(Spectate[playerid]);
	    PlayerSpectateVehicle(playerid, carid);
		SpectateState[id] = 2;
	}
	else {
	    PlayerSpectatePlayer(playerid, Spectate[playerid]);
		SpectateState[id] = 1;
	}

	PlayerTextDrawSetString(playerid, TextDrawSpec[playerid][1], "LOADING...");
	PlayerTextDrawShow(playerid, TextDrawSpec[playerid][1]);
	return 1;
}
Reply
#5

Quote:
Originally Posted by jlalt
Посмотреть сообщение
PHP код:
[22:42:07] [debug#0 native format () from samp03svr
[22:42:07] [debug#1 00259a4c in public OnPlayerCommandText () at D:\gamemode\gamemodes\exgaming.pwn:35215 
can you show the line 35215? [ the range of it +10 lines above and +10 line below it too. ]
bump
Reply
#6

Remove the slash (/), or escape it.

https://stackoverflow.com/questions/...ward-slash-and
Reply
#7

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
Remove the slash (/), or escape it.

https://stackoverflow.com/questions/...ward-slash-and
i did, but isn't because of this.
Reply
#8

Don't use two command registerers at the same time, this will cause a lot of bugs.
Reply
#9

Quote:
Originally Posted by edyun
Посмотреть сообщение
Don't use two command registerers at the same time, this will cause a lot of bugs.
There are not two commands with the same name, there are with different name, but some have CMD not YCMD.

same crash, same line, https://pastebin.com/5Sbw4Hvz
Reply
#10

YCMD? Seriously?
Anyway dpu you luting your commands inside onplayercommandtext or something? It is also getting error in that callback, show it to us.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)