SA-MP Forums Archive
Crashing when compiling - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Crashing when compiling (/showthread.php?tid=126506)



Crashing when compiling - Chivava - 08.02.2010

Hello apparently i have got a major bug..

None of my admin cmds doesnt works at all..

this has happend right after i added /undercoveradmin..

This is how it looks alike..
I have tried to add a } at the end of the cmd but then it crashes.

Код:
	if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0) // By Chivava
	{
		if(IsPlayerConnected(playerid))
		{
		  new id = ReturnUser(tmp);
		  if(gPlayerLogged[playerid] == 0)
		  {
		    SendClientMessage(playerid, COLOR_GREY, "  You need to login first !");
				return 1;
		  }
		  if(PlayerInfo[playerid][pAdmin] > 0)
		  {
		    if(UnderCoverAdmin[playerid] == 0)
		    {
		      UnderCoverAdmin[playerid] = 1;
		      SetPlayerArmour(playerid, 999);
					SetPlayerHealth(playerid, 999);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went on undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					if(PlayerInfo[playerid][pAdmin] >= 5)
					{
					  for(new i = 0; i < sizeof(CarInfo); i++)
						{
							SetVehicleParamsForPlayer(i,playerid,0,0);
						}
					}
					return 1;
		    }
		    else if(UnderCoverAdmin[playerid] == 1)
		    {
		      UnderCoverAdmin[playerid] = 0;
		      SetPlayerArmour(playerid, 0);
					SetPlayerHealth(playerid, 100);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went off undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					return 1;
		    }
		  }
		  else
		  {
		    SendClientMessage(playerid, COLOR_GREY, "  You're not the admin !");
		    return 1;
				}
  			}



Re: Crashing when compiling - akis_tze - 08.02.2010

that happens some times, try to recreate your cmd


Re: Crashing when compiling - BlackFoX - 09.02.2010

pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0)) // By Chivava



Re: Crashing when compiling - Chivava - 09.02.2010

Quote:
Originally Posted by BlackFoX_UD_
pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0)) // By Chivava
Whats wrong with the line ?


Re: Crashing when compiling - (Jeff) - 09.02.2010

Quote:
Originally Posted by Chivava
Quote:
Originally Posted by BlackFoX_UD_
pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0)) // By Chivava
Whats wrong with the line ?
try:
pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0) //Edited by noob1337



Re: Crashing when compiling - Chivava - 09.02.2010

Quote:
Originally Posted by Noob1337
Quote:
Originally Posted by Chivava
Quote:
Originally Posted by BlackFoX_UD_
pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0)) // By Chivava
Whats wrong with the line ?
try:
pawn Код:
if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0) //Edited by noob1337
Didnt make any difference.



Re: Crashing when compiling - mansonh - 09.02.2010

The only way to get around a crash compile is to eliminate parts of your script using /*..*/
Just put it around most of your script, and keep "adding" back more of your script until the compile crash occurs.
Using this technique you should be able to eliminate it down to one line.


Re: Crashing when compiling - SlashPT - 09.02.2010

well i have this

Код:
 	if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0) // By Chivava
	{
		if(IsPlayerConnected(playerid))
		{
	 		new id = ReturnUser(tmp);
	  		if(gPlayerLogged[playerid] == 0)
		  {
	   		SendClientMessage(playerid, COLOR_GREY, "  You need to login first !");
				return 1;
	  		}
		  if(PlayerInfo[playerid][pAdmin] > 0)
		  {
	   		if(UnderCoverAdmin[playerid] == 0)
	    		{
	     		UnderCoverAdmin[playerid] = 1;
	      		SetPlayerArmour(playerid, 999);
					SetPlayerHealth(playerid, 999);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went on undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					if(PlayerInfo[playerid][pAdmin] >= 5)
					{
	  				for(new i = 0; i < sizeof(CarInfo); i++)
						{
							SetVehicleParamsForPlayer(i,playerid,0,0);
						}
					}
					return 1;
	  		}
	   		else if(UnderCoverAdmin[playerid] == 1)
	    	{
	    			UnderCoverAdmin[playerid] = 0;
	     		SetPlayerArmour(playerid, 0);
					SetPlayerHealth(playerid, 100);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went off undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					return 1;
	  		}
	  	}
		  else
		  {
	   		SendClientMessage(playerid, COLOR_GREY, "  You're not the admin !");
	    		return 1;
			}
		}
	}
and works for me...

if continues with the same problem its because its in other place of the script and not here[in this cmd]...


Re: Crashing when compiling - Chivava - 09.02.2010

Quote:
Originally Posted by DarK TeaM PT
well i have this

Код:
 	if(strcmp(cmd, "/undercoveradmin", true) == 0 || strcmp(cmd, "/uca", true) == 0) // By Chivava
	{
		if(IsPlayerConnected(playerid))
		{
	 		new id = ReturnUser(tmp);
	 		if(gPlayerLogged[playerid] == 0)
		  {
	  		SendClientMessage(playerid, COLOR_GREY, " You need to login first !");
				return 1;
	 		}
		  if(PlayerInfo[playerid][pAdmin] > 0)
		  {
	  		if(UnderCoverAdmin[playerid] == 0)
	   		{
	    		UnderCoverAdmin[playerid] = 1;
	     		SetPlayerArmour(playerid, 999);
					SetPlayerHealth(playerid, 999);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went on undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					if(PlayerInfo[playerid][pAdmin] >= 5)
					{
	  				for(new i = 0; i < sizeof(CarInfo); i++)
						{
							SetVehicleParamsForPlayer(i,playerid,0,0);
						}
					}
					return 1;
	  		}
	   		else if(UnderCoverAdmin[playerid] == 1)
	    	{
	   			UnderCoverAdmin[playerid] = 0;
	    		SetPlayerArmour(playerid, 0);
					SetPlayerHealth(playerid, 100);
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "You have went off undercover admin duty.", id);
					SendClientMessage(playerid, COLOR_YELLOW,string);
					return 1;
	  		}
	  	}
		  else
		  {
	  		SendClientMessage(playerid, COLOR_GREY, " You're not the admin !");
	   		return 1;
			}
		}
	}
and works for me...

if continues with the same problem its because its in other place of the script and not here[in this cmd]...
Main problem aint /uca doesnt works..
Its about you cant use ANY admin cmds.


Re: Crashing when compiling - SlashPT - 09.02.2010

oh maybe your using one FS wich haves in the end of the OnPlayerCommandText one

Код:
return 1;
try change to

Код:
return 0;