Commands not working for no reason?
#1

Код:
CMD:stats(playerid, params[])
{
	new target;
	if(sscanf(params, "u", target))
	{
  		target = playerid;
		Server(playerid, "You can also use /stats [playerid]");
	}
	if(!IsPlayerConnected(target)) return Error(playerid, "Player is not connected.");
	if(User[target][loggedin] == 0) return Error(playerid, "Player is not logged in.");
    GetPlayerConnectedTime(target, User[target][ohours], User[target][ominutes], User[target][oseconds]);

	new
		DIALOG[1000],
		string[312],
		data[2][48],
		yes[4] = "Yes",
		no[3] = "No",
		Float:ratio
	;

	new handle = SQL::OpenEx(SQL::READ, ""PLAYERS_TABLE"", "username", GetName(target));
 	SQL::ReadString(handle, "joined", data[1], 48);
 	SQL::Close(handle);

	format(string, sizeof(string), ""purple"NRG Stats for %s's (ID:%i):\n\n", GetName(target), target);
	strcat(DIALOG, string);

    strcat(DIALOG, ""lightred"Main Statistics:\n");

	format(string, sizeof(string), ""white"•"lightblue"Account ID: "green"%i\n", User[target][id]);
	strcat(DIALOG, string);
	
	format(string, sizeof(string), ""white"•"lightblue"Registered date: "green"%s\n", data[1]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Online Time: "green"%02i hours %02i minutes %02i seconds\n", User[target][ohours], User[target][ominutes], User[target][oseconds]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Kills: "green"%i\n", User[target][kills]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Deaths: "green"%i\n", User[target][deaths]);
	strcat(DIALOG, string);

	if(User[target][deaths] <= 0) ratio = 0.0;
	else ratio = floatdiv(User[target][kills], User[target][deaths]);
	format(string, sizeof(string), ""white"•"lightblue"K/D Ratio: "green"%0.2f\n", ratio);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Score: "green"%i\n", GetPlayerScore(target));
	strcat(DIALOG, string);
	
	format(string, sizeof(string), ""white"•"lightblue"Money: "green"$%i\n", GetPlayerMoney(target));
	strcat(DIALOG, string);
	
	format(string, sizeof(string), ""white"•"lightblue"Cookies: "green"%i\n\n", User[target][cookies]);
	strcat(DIALOG, string);

    strcat(DIALOG, ""lightred"Event Statistics:\n");
	
	format(string, sizeof(string), ""white"•"lightblue"Math Wins: "green"%i\n", User[target][maths]);
	strcat(DIALOG, string);
	
	format(string, sizeof(string), ""white"•"lightblue"Moneybag Founds: "green"%i\n", User[target][mbfound]);
	strcat(DIALOG, string);
	
	format(string, sizeof(string), ""white"•"lightblue"ReactionContest Wins: "green"%i\n\n", User[target][reactions]);
	strcat(DIALOG, string);
	
	strcat(DIALOG, ""lightred"Other Statistics:\n");

	format(string, sizeof(string), ""white"•"lightblue"Wanteds: "green"%i\n", User[target][wanteds]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Admin Level: "green"%i\n", User[target][level]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"VIP Level: "green"%i\n", User[target][vip]);
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Trusted Player: "green"%s\n", ((IsPlayerTrusted(target)) ? yes : no));
	strcat(DIALOG, string);


	format(string, sizeof(string), ""white"•"lightblue"Jailed: "green"%s\n", ((IsPlayerJailed(target)) ? yes : no));
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Muted: "green"%s\n", ((IsPlayerMuted(target)) ? yes : no));
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Command Muted: "green"%s\n", ((IsPlayerCMDMuted(target)) ? yes : no));
	strcat(DIALOG, string);

	format(string, sizeof(string), ""white"•"lightblue"Warnings: "green"%i/%i\n", User[target][warns], MAX_WARNS);
	strcat(DIALOG, string);

	Dialog_Show(playerid, dialogUnused, DIALOG_STYLE_MSGBOX, "NRG Statistics", DIALOG, "Close", "");
	return 1;
}
for some reason whenever i type /stats it shows

< if this is not working then http://imgur.com/a/rYrZ4
Reply
#2

i think this has to do something with my MySQL system but it shows that its connected to Mysql...
Reply
#3

Try add some prints and see where it stops.
Reply
#4

Hello, Sorry I was talking off topic, Pardon me, I just want to ask as he provide an image link of screen shots, When the command not found in server, The text draw appear unknow Command use /cmds Where I can find tutorial About this, As I also want to learn this If someone type unknow command textdraw appear on their screen unknown command use /cmds ? How?
Reply
#5

are you using OnPlayerCommandPerformed callback if yes show it.
Reply
#6

Your command functions crashing, use crashdetect plugin and check what it will print after using the command.

Crashdetect: https://sampforum.blast.hk/showthread.php?tid=262796
Reply
#7

Thanks everyone for helping and i figured it out it was a mistake of one of my scripts fixed it! , thanks jlalt for the CrashDetect and BlackBirdXD , if you want to know give me a pm and ill tell you
Reply
#8

Quote:
Originally Posted by donhu789
Посмотреть сообщение
Thanks everyone for helping and i figured it out it was a mistake of one of my scripts fixed it! , thanks jlalt for the CrashDetect and BlackBirdXD , if you want to know give me a pm and ill tell you
Nope post the solution here if you wanted a pm to tell your solution you could pm a private helper for helping no need of posting a thread. But since you posted a thread post the solution too.
Reply
#9

Quote:
Originally Posted by donhu789
Посмотреть сообщение
Thanks everyone for helping and i figured it out it was a mistake of one of my scripts fixed it! , thanks jlalt for the CrashDetect and BlackBirdXD , if you want to know give me a pm and ill tell you
Why not You tell here or post tutorial If Newbies Like me Come to this section They probably getting Something to learn new things.
Reply
#10

Quote:
Originally Posted by BlackbirdXd
Посмотреть сообщение
Why not You tell here or post tutorial If Newbies Like me Come to this section They probably getting Something to learn new things.
When he said come to my pm to tell you how to fix it he meant he gonna teach you "BlackbirdXd" how to create on screen text if used unknow command.
not how he fixed the problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)