SA-MP Forums Archive
Help me - My /scrapcar isn't working. - 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)
+--- Thread: Help me - My /scrapcar isn't working. (/showthread.php?tid=119389)



Help me - My /scrapcar isn't working. - jameskmonger - 08.01.2010

Код:
		if(strcmp(cmd, "/scrapcar", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		  if(IsPlayerInAnyVehicle(playerid))
		  {
				IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
				{
				  PlayerInfo[playerid][pMaterials] + 60;
					PlayerActionMessage(playerid,15.0,"cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
				} else {
					SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
			} else {
			    SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		} else {
		      SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");
 	}
And I get these errors:

Код:
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1197) : error 017: undefined symbol "ShowServerPassword"
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1264) : error 004: function "FixHour" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1306) : error 004: function "KickPlayer" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1323) : error 017: undefined symbol "ClearScreen"
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1324) : error 004: function "ShowScriptStats" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1326) : error 017: undefined symbol "RPName"
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1348) : error 004: function "KickPlayer" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1354) : error 004: function "LoadDynamicFactions" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1355) : error 004: function "LoadDynamicCars" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1356) : error 004: function "LoadCivilianSpawn" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1357) : error 004: function "LoadBuildings" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1358) : error 004: function "LoadHouses" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1359) : error 004: function "LoadBusinesses" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1360) : error 004: function "LoadFactionMaterialsStorage" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1361) : error 004: function "LoadFactionDrugsStorage" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1362) : error 004: function "LoadDrivingTestPosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1363) : error 004: function "LoadFlyingTestPosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1364) : error 004: function "LoadBankPosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1365) : error 004: function "LoadWeaponLicensePosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1366) : error 004: function "LoadPoliceArrestPosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1367) : error 004: function "LoadPoliceDutyPosition" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1368) : error 004: function "LoadGunJob" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1369) : error 004: function "LoadDrugJob" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1370) : error 004: function "LoadDetectiveJob" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1371) : error 004: function "LoadLawyerJob" is not implemented
C:\Users\James\Desktop\RWRP\gamemodes\crp.pwn(1372) : error 004: function "LoadProductsSellerJob" is not implemented

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.



Re: Help me - My /scrapcar isn't working. - bajskorv123 - 08.01.2010

Код:
if(strcmp(cmd, "/scrapcar", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
		{
		  PlayerInfo[playerid][pMaterials] + 60;
		  PlayerActionMessage(playerid,15.0,"Cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
		} else {
	    SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");
 	}
    return 1;
}
Hope this helped


Re: Help me - My /scrapcar isn't working. - jameskmonger - 08.01.2010

I still get the errors.


Re: Help me - My /scrapcar isn't working. - Faraday - 08.01.2010

check your brackets, there's probably one missing.

after the "Login First" needs an extra bracket

EDIT: this should do it: but fix the identation of my bracket because I'm too lazy to open pawno right now
Код:
if(strcmp(cmd, "/scrapcar", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
		{
		  PlayerInfo[playerid][pMaterials] + 60;
		  PlayerActionMessage(playerid,15.0,"Cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
		} else {
	    SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first."); 
           }
 	}
    return 1;
}



Re: Help me - My /scrapcar isn't working. - jameskmonger - 08.01.2010

I tried it like this:

Код:
	if(strcmp(cmd, "/scrapcar", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
		{
		  PlayerInfo[playerid][pMaterials] + 60;
		  PlayerActionMessage(playerid,15.0,"Cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
		} else {
	    SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");
 	}
  }
    return 1;
}
and like this:
Код:
	if(strcmp(cmd, "/scrapcar", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
	    IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
		{
		  PlayerInfo[playerid][pMaterials] + 60;
		  PlayerActionMessage(playerid,15.0,"Cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
		} else {
	    SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		} else {
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");
 	}
  }
	}
    return 1;
}
But it still doesn't work.


Re: Help me - My /scrapcar isn't working. - Lajko1 - 08.01.2010

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[256];
	
	if(strcmp(cmd, "/scrapcar", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
	  if(IsPlayerInAnyVehicle(playerid))
	  {
   	if IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
   	{
  	PlayerInfo[playerid][pMaterials] + 60;
  	PlayerActionMessage(playerid,15.0,"Cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
		else
		{
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
		return 1;
		}
		else
		{
 		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		return 1;
		}
		else
		{
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");
		return 1;
		}
	}
	return 1;
}
idk try with that i am not sure it will work i just try to make something with that code ... if wont work any of these codes that ppl post mybe problem should be somewhere else


Re: Help me - My /scrapcar isn't working. - Babul - 08.01.2010

i rearranged the "else" statements. give it a try
a single line for each bracket made it easier...
Код:
if(strcmp(cmd, "/scrapcar", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			if(IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)==1)
			{
				PlayerInfo[playerid][pMaterials] + 60;
				PlayerActionMessage(playerid,15.0,"cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");
			}
			else
			{
			SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");//this will print out a text to a not-connected player?
	}
	return 1;
}
if someone now wants to complain about me blowing up the code, then have a look at this line:
Код:
if(strcmp(cmd, "/scrapcar", true) == 0){if(IsPlayerConnected(playerid)){if(IsPlayerInAnyVehicle(playerid)){if(IsPlayerInArea(playerid, 214.973251, 208.995681, 27.271835, 22.040054)==1){PlayerInfo[playerid][pMaterials] + 60;PlayerActionMessage(playerid,15.0,"cuts his car into small pieces, and gets 60 blocks of scrap metal from it.");}else{SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be at the warehouse to scrap your car.");}}else{SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");}}else{SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] Login first.");//this will print out a text to a not-connected player?}return 1;}
-no comment-


Re: Help me - My /scrapcar isn't working. - jameskmonger - 08.01.2010

Quote:
Originally Posted by Seif_
Your indentation screwed up the code. Always indent your code properly and you'll see your errors faster. You'll rarely do any bracket errors matter of fact.
Seif, could you make me a new snippet for the command?


Re: Help me - My /scrapcar isn't working. - darkbrendan6 - 02.10.2011

if(strcmp(cmd, "/scrapcar", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
IsPlayerInRangeOfPoint(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
{
PlayerInfo[playerid][pMaterials] + 60;
PlayerActionMessage(playerid,15.0,"Your car is cut into 60 pieces of scrap metal");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You must be at the warehouse to scrap your car");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
}
return 1;
}


Re: Help me - My /scrapcar isn't working. - darkbrendan6 - 02.10.2011

Код HTML:
if(strcmp(cmd, "/scrapcar", true) == 0)
{
      if(IsPlayerInAnyVehicle(playerid))
      {
           IsPlayerInRangeOfPoint(playerid, 214.973251, 208.995681, 27.271835, 22.040054)
	   {
		  PlayerInfo[playerid][pMaterials] + 60;
		  PlayerActionMessage(playerid,15.0,"Your car is cut into 60 pieces of scrap metal");
	   }
           else
           {
		  SendClientMessage(playerid, COLOR_WHITE, "You must be at the warehouse to scrap your car");
	   }
           else
           {
	          SendClientMessage(playerid, COLOR_WHITE, "[ERROR:] You must be driving a car to scrap it.");
           }
	   return 1;
 	}