Unknon command
#1

when i type "/seif login" or "/seif depune" or "/seif extrage" or "/seif setpin" server show me "Unknow command", and nothing happens. What's wrong? ?

Код:
	if(strcmp(cmdtext, "/seif", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        //new sendername[MAX_PLAYER_NAME];
			//GetPlayerName(playerid, sendername, sizeof(sendername));
	        for(new s=0; s<MAX_PLAYERS; s++)
		 	{
		 	    if(PlayerToPoint(0.5, playerid, SeifInfo[s][sEnterX], SeifInfo[s][sEnterY], SeifInfo[s][sEnterZ]))
				{
					new text[20];
					text = strtok(cmdtext, idx);
					if(!strlen(tmp))
					{
						SCM(playerid, c_alb, "|____________________________ Seif ____________________________|");
						SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Nume Valabile: login, status, extrage, depune, setpin");
						SCM(playerid, c_alb, "|______________________________________________________________|");
						return 1;
					}
					else if(strcmp(text, "login", true) == 0)
					{
					    if(SeifLogin[playerid] == 1) return SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}]Esti logat la un seif.");
						new pas[50];
						pas = strtok(cmdtext, idx);
						if(!strlen(pas))
						{
						    SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Foloseste '{F48651}/seif login [parola]");
						    return 1;
						}
						if(strcmp(pas, SeifInfo[s][sPass], true) == 0)
						{
						    SeifLogin[playerid] = 1;
		  					format(string, sizeof(string), "{FFFFFF}[{67BDFC}System{FFFFFF}]Te-ai logat la {F48651}seiful %d{FFFFFF} cu {F48651}parola %s{FFFFFF}.", s, pas);
		  					SCM(playerid, c_alb, string);
						}
					}
					else if(strcmp(text, "depune", true) == 0)
					{
					    if(SeifLogin[playerid] == 0) return SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Trebuie sa te loghezi la un seif pentru a putea umbla in el.");
						new moneys = strval(tmp);
						if(moneys < 0)
						{
						    SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Nu poti depune o suma asa mica.");
						    return 1;
						}
						if(moneys > GetPlayerMoney(playerid))
						{
						    SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Ai suficienti bani la tine.");
						    return 1;
						}
						else
						{
							SeifInfo[s][sMoney] += moneys;
							GivePlayerMoney(playerid, -moneys);
							format(string, sizeof(string), "{FFFFFF}[{67BDFC}System{FFFFFF}] Ai depus in {F48651}seiful %d{FFFFFF}o {F48651}suma de %d${FFFFFF}.", s, moneys);
							SCM(playerid, c_alb, string);
							format(string, sizeof(string), "{FFFFFF}[{DD0000}CMD{FFFFFF}] {F48651}%s a depus in {F48651}seiful %d{FFFFFF}o {F48651}suma de %d${FFFFFF}.", sendername, s, moneys);
							SAM( c_alb, string);
						}
					}
					else if(strcmp(text, "extrage", true) == 0)
					{
					    if(SeifLogin[playerid] == 0)    return SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Trebuie sa te loghezi la un seif pentru a putea umbla in el.");
						new moneys = strval(tmp);
						if(SeifInfo[s][sMoney] < 0)
						{
						    SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] In seif nu exista aceasta suma.");
						    return 1;
						}
						if(moneys > SeifInfo[s][sMoney])
						{
						    SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Nu poti extrage atatia bani.");
						    return 1;
						}
						else
						{
							SeifInfo[s][sMoney] -= moneys;
							GivePlayerMoney(playerid, moneys);
							format(string, sizeof(string), "{FFFFFF}[{67BDFC}System{FFFFFF}] Ai extras din {F48651}seiful %d{FFFFFF}o {F48651}suma de %d${FFFFFF}.", s, moneys);
							SCM(playerid, c_alb, string);
							format(string, sizeof(string), "{FFFFFF}[{DD0000}CMD{FFFFFF}] {F48651}%s a extras din {F48651}seiful %d{FFFFFF}o {F48651}suma de %d${FFFFFF}.", sendername, s, moneys);
							SAM(c_alb, string);
						}
					}
					/*else if(strcmp(text, "status", true) == 0)
					{
					    if(SeifLogin[playerid] == 0)    return SCM(playerid, "{FFFFFF}[{67BDFC}System{FFFFFF}] Trebuie sa te loghezi la un seif pentru a putea umbla in el.");
						format(string, sizeof(string), "{FFFFFF}[{67BDFC}System{FFFFFF}] In {F48651}seiful %d{FFFFFF}se gaseste o {F48651}suma de %d${FFFFFF}.", s, SeifInfo[s][sMoney});
						SCM(playerid, c_alb, string);
					}
					*/
					else if(strcmp(text, "setpin", true) == 0)
					{
                        if(SeifLogin[playerid] == 0) return SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Trebuie sa te loghezi la un seif pentru a putea umbla in el.");
						format(string, sizeof(string), "{FFFFFF}[{67BDFC}System{FFFFFF}] Aceasta comanda a fost scoasa momentan pentru {F48651}seiful %d{FFFFFF}.", s);
						SCM(playerid, c_alb, string);
					}
					else SCM(playerid, c_alb, "{FFFFFF}[{67BDFC}System{FFFFFF}] Nu exista aceasta optine.");
				}//else return SCM(player, c_alb, "Nu esti langa un seif.");
			}
		}
		return 1;
	}
Reply
#2

Do the rest of the commands use strcmp too or another command processor?
Reply
#3

strcmp...
Reply
#4

Load crashdetect plugin then.
Reply
#5

Код:
[00:36:57] Number of vehicle models: 6
[00:37:26] Incoming connection: 127.0.0.1:3103
[00:37:27] [join] Test has joined the server (0:127.0.0.1)
[00:37:30] [debug] Run time error 4: "Array index out of bounds"
[00:37:30] [debug]  Accessing element at index 4 past array upper bound 3
[00:37:30] [debug] AMX backtrace:
[00:37:30] [debug] #0 00022130 in public OnDialogResponse (0x00000000, 0x00000000, 0x00000001, 0xffffffff, 0x0008ab74) from v0.5b.amx
[00:37:42] [CMD] Test: /seif
[00:37:44] [CMD] Test: /seif
[00:37:45] [CMD] Test: /seif
[00:37:51] [CMD] Test: /seif
[00:37:53] [CMD] Test: /seif
[00:37:57] [CMD] Test: /seif
[00:37:59] [debug] Run time error 4: "Array index out of bounds"
[00:37:59] [debug]  Accessing element at index 4 past array upper bound 3
[00:37:59] [debug] AMX backtrace:
[00:37:59] [debug] #0 00023264 in public SSCANF_OnPlayerDisconnect (0x00000000, 0x00000001) from v0.5b.amx
[00:37:59] [debug] #1 00001a00 in public Streamer_OnPlayerDisconnect (0x00000000, 0x00000001) from v0.5b.amx
[00:37:59] [debug] #2 000003bc in public OnPlayerDisconnect (0x00000000, 0x00000001) from v0.5b.amx
[00:37:59] [part] Test has left the server (0:1)
[00:38:19] --- Server Shutting Down.
[00:38:20] [FS] with objects - unloaded!
[00:38:20]
Reply
#6

As I thought, a run time error was caused. You'll need to compile with debug info so we can get the line caused the crash. By the way, I hope you've loaded the latest version of crashdetect which is 4.13

After done the above, re-compile your scripts, run the server and execute the command again. Post the new server log once again.
Reply
#7

Код:
[03:02:33]  
[03:02:33] Number of vehicle models: 6
[03:02:59] Incoming connection: 127.0.0.1:1388
[03:02:59] [join] Test has joined the server (0:127.0.0.1)
[03:03:10] [debug] Run time error 4: "Array index out of bounds"
[03:03:10] [debug]  Accessing element at index 4 past array upper bound 3
[03:03:10] [debug] AMX backtrace:
[03:03:10] [debug] #0 0002b060 in public OnDialogResponse (playerid=0, dialogid=0, response=1, listitem=-1, inputtext[]=@0x0008aba4 "1") at C:\~Jocuri~\Trucking samp\gamemodes\v0.5b.pwn:2197
[03:03:20] [CMD] Test: /seif
[03:03:22] [CMD] Test: /seif
[03:03:27] [CMD] Test: /seif
[03:03:28] [CMD] Test: /seif
[03:03:30] [debug] Run time error 4: "Array index out of bounds"
[03:03:30] [debug]  Accessing element at index 4 past array upper bound 3
[03:03:30] [debug] AMX backtrace:
[03:03:30] [debug] #0 0002c5d0 in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\gamemodes\v0.5b.pwn:2351
[03:03:30] [debug] #1 00001eec in public Streamer_OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\pawno\include\sscanf2.inc:229
[03:03:30] [debug] #2 00000474 in public OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\pawno\include\streamer.inc:297
[03:03:30] [part] Test has left the server (0:1)
[03:03:58] --- Server Shutting Down.
[03:03:59] [FS] with objects - unloaded!
[03:03:59]
Line 2197: TextDrawShowForPlayer(playerid, Logo[t]);

No error/warning at command /seif...
Reply
#8

It seems that there are 2 parts that give the run time error. One in OnDialogResponse callback and line 2197 (before executing the command - so this one has nothing to do with it) and the other one after disconnecting and line 2351. The problem is the loop so do:
pawn Код:
for (new t; t != sizeof (Logo); ++t)
{
    // code..
    TextDrawShowForPlayer(playerid, Logo[t]);
}
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It seems that there are 2 parts that give the run time error. One in OnDialogResponse callback and line 2197 (before executing the command - so this one has nothing to do with it) and the other one after disconnecting and line 2351. The problem is the loop so do:
pawn Код:
for (new t; t != sizeof (Logo); ++t)
{
    // code..
    TextDrawShowForPlayer(playerid, Logo[t]);
}
This problem solved, but /seif ... don't work..
Код:
[03:17:42] Number of vehicle models: 6
[03:18:14] Incoming connection: 127.0.0.1:1576
[03:18:14] [join] Test has joined the server (0:127.0.0.1)
[03:18:27] [CMD] Test: /seif
[03:18:29] [CMD] Test: /seif
[03:18:31] [CMD] Test: /seif
[03:18:33] [debug] Run time error 4: "Array index out of bounds"
[03:18:33] [debug]  Accessing element at index 5 past array upper bound 4
[03:18:33] [debug] AMX backtrace:
[03:18:33] [debug] #0 0002c680 in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\gamemodes\v0.5b.pwn:2355
[03:18:33] [debug] #1 00001eec in public Streamer_OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\pawno\include\sscanf2.inc:229
[03:18:33] [debug] #2 00000474 in public OnPlayerDisconnect (playerid=0, reason=1) at C:\~Jocuri~\Trucking samp\pawno\include\streamer.inc:297
[03:18:33] [part] Test has left the server (0:1)
[03:18:41] --- Server Shutting Down.
[03:18:42] [FS] with objects - unloaded!
[03:18:42]
But..command is good?
Reply
#10

The run time error is not from the command but OnPlayerDisconnect callback again. Post line 2355.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)