SA-MP Forums Archive
Some thing crashing my gamemode - 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: Some thing crashing my gamemode (/showthread.php?tid=112447)



Some thing crashing my gamemode - WardenCS - 07.12.2009

Hey,well i wanted to make if your near GasBarrels you can search gas,well,but it crashes the game,and server goes off..heres the GasBarrels
Код:
public GasBarrels(playerid)
{
  if(IsPlayerConnected(playerid))
	{
    if(PlayerToPoint(5.0,playerid,2491.2207, -1666.8200, 12.8230) || PlayerToPoint(5.0,playerid,2413.2309, -1372.7017, 24.0660))
		{
		  return 1;
		}
		else if(PlayerToPoint(5.0,playerid,2393.1960, -1451.4156, 23.4748) || PlayerToPoint(5.0,playerid,2043.6928, -1509.8106, 2.9595))
		{
		  return 1;
		}
				else if(PlayerToPoint(5.0,playerid,1928.6831, -1543.4710, 13.1165) || PlayerToPoint(5.0,playerid,1326.8248, -1435.9821, 14.4392))
		{
		  return 1;
		}
						else if(PlayerToPoint(5.0,playerid,1251.6204, -1430.5838, 13.0122) || PlayerToPoint(5.0,playerid,913.5208, -1246.5333, 15.1451))
		{
		  return 1;
		}
		else if(PlayerToPoint(5.0,playerid,913.5208, -1246.5333, 15.1451))
		{
		  return 1;
		}
	}
	return 0;
}
Heres the command

Код:
	if(strcmp(cmd, "/searchgas", true) == 0)
	 {
	  new sendername[MAX_PLAYER_NAME];
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
	 	new RandomGas = random(50);
		if(IsPlayerConnected(playerid))
	  	{
	  		if(!GasBarrels(playerid))
	  			{
	    	 	SendClientMessage(playerid,WHITE,"*You are not near Gas Barrels!");
	    	return 1;
	  	}
  			SetTimerEx("Search",3500,0,"i",playerid);
  			Gasonplayer += RandomGas ;
  			SendClientMessage(playerid,0x00FF00FF,"You Found %s % of Fuel",RandomGas);
			format(string, sizeof(string), "* %s Found %s of Fuel.", sendername ,RandomGas);
			ProxDetector(30.0, playerid, string, 0xC2A2DAAA);
 	 		return 1;
		}
	}
i think the problem is in public gasbarrels,because i have same thing with other command when i use something like this


Re: Some thing crashing my gamemode - Correlli - 07.12.2009

Quote:
Originally Posted by ZzZzZ
Код:
Public GasBarrels(playerid)
It's public.

Debug your code.


Re: Some thing crashing my gamemode - WardenCS - 07.12.2009

ehh? dont know how,any tutorial?


Re: Some thing crashing my gamemode - Goobiiify - 07.12.2009

Quote:
Originally Posted by ZzZzZ
ehh? dont know how,any tutorial?
Use Print(); and check were it ends. If all Print(); loads successful without one, You know where the problem is. :P


Re: Some thing crashing my gamemode - WardenCS - 08.12.2009

i replace the public with print(); ?


Re: Some thing crashing my gamemode - Abernethy - 08.12.2009

Quote:
Originally Posted by ZzZzZ
i replace the public with print(); ?
No. Change your uppercase 'P' in Public to a lowercase 'p'. So it's public, not Public.


Re: Some thing crashing my gamemode - WardenCS - 08.12.2009

well the 'p' is lowercase...


Re: Some thing crashing my gamemode - DJDhan - 08.12.2009

You mean you made the P capital when you posted it here?
You need to change "Public" to "public".If you have...you don't get any errors or warnings?



Re: Some thing crashing my gamemode - WardenCS - 08.12.2009

in script,the Public is with lowercase 'p' but i think i changed it accidentally,no errors,but i got like 70 warnings i dont know which are which i dont think they are from there
but for /searchgas i get those warnings

Код:
C:\Documents and Settings\Ingrid\Desktop\MRP\gamemodes\Zombie_Survival_2.0.pwn(1854) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Ingrid\Desktop\MRP\gamemodes\Zombie_Survival_2.0.pwn(1856) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Ingrid\Desktop\MRP\gamemodes\Zombie_Survival_2.0.pwn(1856) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Ingrid\Desktop\MRP\gamemodes\Zombie_Survival_2.0.pwn(1856) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Ingrid\Desktop\MRP\gamemodes\Zombie_Survival_2.0.pwn(1856) : warning 202: number of arguments does not match definition
changed searchgas little bit,still crashes

Код:
1842	if(strcmp(cmd, "/searchgas", true) == 0)
1843	 {
1844	  new sendername[MAX_PLAYER_NAME];
1845		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
1846		GetPlayerName(playerid, sendername, sizeof(sendername));
1847	 	new RandomGas = random(50);
1848		if(IsPlayerConnected(playerid))
1849	  	{
1850	  		if(GasBarrels(playerid))
1851	  	{
1852  			SetTimerEx("Search",3500,0,"i",playerid);
1853  			Gasonplayer += RandomGas ;
1854  			SendClientMessage(playerid,0x00FF00FF,"You Found %s % of Fuel",RandomGas);
1855			format(string, sizeof(string), "* %s Found %s of Fuel.", sendername ,RandomGas);
1856			ProxDetector(30.0, playerid, string, 0xC2A2DAAA);
1857			}
1858			else
1559			{
1560			SendClientMessage(playerid, 0xC2A2DAAA,"You Are Not Near Gas Barrels!");
1561			}
1562				return 1;
1563	}
1564}



Re: Some thing crashing my gamemode - WardenCS - 09.12.2009

BUMP!