SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 16/04/2011, 03:35 AM   #1
Swiftz
Banned
 
Join Date: Jan 2011
Posts: 328
Reputation: 0
Default I get tagmismatch error, But i cant find any error error

This is a /pvlock command i made to lock cars. I get tag mismatch error in the lines i marked with red.
Code:
	if(strcmp(cmd, "/pvlock", true) == 0)
	{
     	if(gPlayercars[playerid] == 1)
 		{
     	    new v, Float:vehx, Float:vehy, Float:vehz;
     	    new v2, Float:vehx2, Float:vehy2, Float:vehz2;
     	    new v3, Float:vehx3, Float:vehy3, Float:vehz3;
     	    new Float:PX, Float:PY, Float:PZ;
			v = Vehicle[playerid];
			v2 = Vehicle2[playerid];
			v3 = Vehicle3[playerid];
	    	GetVehiclePos(v, vehx, vehy, vehz);
	    	GetVehiclePos(v2, vehx2, vehy2, vehz2);
	    	GetVehiclePos(v3, vehx3, vehy3, vehz3);
	    	GetPlayerPos(playerid, PX, PY, PZ);
            new Distance1 = GetDistanceBetweenPoints(PX, PY, PZ, vehx, vehy, vehz);
            new Distance2 = GetDistanceBetweenPoints(PX, PY, PZ, vehx2, vehy2, vehz2);
            new Distance3 = GetDistanceBetweenPoints(PX, PY, PZ, vehx3, vehy3, vehz3);
            if(Distance1 < Distance2 && Distance1 < Distance2)
			{
    		   if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx, vehy, vehz))
   		       {
    		      if(VehicleInfo[playerid][Locked] == 0)
    		      {
			   		SetVehicleParamsForPlayer(v, playerid, 0, 1);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~r~Car locked!", 3000, 6);
 					VehicleInfo[playerid][Locked] = 1;
	 				gVehLocked[v] = 1;
					return 1;
		          }
				  if(VehicleInfo[playerid][Locked] == 1)
    		      {
					SetVehicleParamsForPlayer(v, playerid, 0, 0);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~g~Car unlocked!", 3000, 6);
 					VehicleInfo[playerid][Locked] = 0;
	 				gVehLocked[v] = 0;
					return 1;
				  }
			  }
			  else
			  {
			    SendClientMessage(playerid, 0xAFAFAFAA, "You are too far away from your vehicle.");
			    return 1;
   			  }
		    }
            if(Distance2 < Distance3 && Distance2 < Distance1)
			{
    		   if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx2, vehy2, vehz2))
   		       {
    		      if(VehicleInfo2[playerid][Locked2] == 0)
    		      {
			   		SetVehicleParamsForPlayer(v2, playerid, 0, 1);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~r~Car locked!", 3000, 6);
 					VehicleInfo2[playerid][Locked2] = 1;
	 				gVehLocked[v2] = 1;
					return 1;
		          }
				  if(VehicleInfo2[playerid][Locked2] == 1)
    		      {
					SetVehicleParamsForPlayer(v2, playerid, 0, 0);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~g~Car unlocked!", 3000, 6);
 					VehicleInfo2[playerid][Locked2] = 0;
	 				gVehLocked[v2] = 0;
					return 1;
				  }
			  }
			  else
			  {
			    SendClientMessage(playerid, 0xAFAFAFAA, "You are too far away from your vehicle.");
			    return 1;
   			  }
			}
            if(Distance3 < Distance2 && Distance3 < Distance1)
			{
    		   if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx3, vehy3, vehz3))
   		       {
    		      if(VehicleInfo3[playerid][Locked3] == 0)
    		      {
			   		SetVehicleParamsForPlayer(v3, playerid, 0, 1);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~r~Car locked!", 3000, 6);
 					VehicleInfo3[playerid][Locked3] = 1;
	 				gVehLocked[v3] = 1;
					return 1;
		          }
				  if(VehicleInfo3[playerid][Locked3] == 1)
    		      {
					SetVehicleParamsForPlayer(v3, playerid, 0, 0);
			    	PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
					GameTextForPlayer(playerid, "~g~Car unlocked!", 3000, 6);
 					VehicleInfo3[playerid][Locked3] = 0;
	 				gVehLocked[v3] = 0;
					return 1;
				  }
			  }
			  else
			  {
			    SendClientMessage(playerid, 0xAFAFAFAA, "You are too far away from your vehicle.");
			    return 1;
   			  }
			}
		}
		else
		{
		    SendClientMessage(playerid, 0xAFAFAFAA, "You don't own a vehicle.");
		}
		return 1;
	}
Swiftz is offline  
Old 16/04/2011, 04:31 AM   #2
randomkid88
Huge Clucker
 
Join Date: Mar 2010
Posts: 308
Reputation: 1
Default Re: I get tagmismatch error, But i cant find any error error

Doesn't GetDistanceBetweenPoints return a float? Try:
pawn Code:
new Float:Distance1 = GetDistanceBetweenPoints(PX, PY, PZ, vehx, vehy, vehz);
new Float:Distance2 = GetDistanceBetweenPoints(PX, PY, PZ, vehx2, vehy2, vehz2);
new Float:Distance3 = GetDistanceBetweenPoints(PX, PY, PZ, vehx3, vehy3, vehz3);
__________________


randomkid88 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cant find what the prob is , 1 error Swiftz Help Archive 3 15/04/2011 02:44 AM
Find an error falor Help Archive 4 23/04/2010 10:44 AM
Do you get an error where You can't find an Include? Read! HotSauce Help Archive 6 11/04/2010 03:29 PM
Canīt find the error!? SEC Help Archive 2 29/06/2009 04:56 PM
I can't find where is the error. Shellegg Help Archive 1 27/03/2009 07:54 PM


All times are GMT. The time now is 02:18 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.