help plz PutPlayerInVehicle not work
#1

sorry if tread wrong section & my english skill not good

thank for all answer future

this script i make for real steal car design from /trunk and fix more

How : All car locked if player want to steal car , must near vehicle player want and use command

if success put player in driver seat (or disable lock car if i can do)

now bug "PutPlayerInVehicle" when success

my code

Код:
if(strcmp(cmd,"/jackcar",true)==0|| strcmp(cmd, "/ja", true) == 0)
		{
		    new level = PlayerInfo[playerid][pJackSkill];
			if(level >= 0 && level <= 750) { JackCarStart[playerid] = 5; }
			else if(level >= 751 && level <= 1250) { JackCarStart[playerid] = 4; }
			else if(level >= 1251 && level <= 1850) { JackCarStart[playerid] = 3; }
			else if(level >= 1851 && level <= 2200) { JackCarStart[playerid] = 2; }
			else if(level >= 2201) { JackCarStart[playerid] = 1; }
		
   			new counter = 0;
  			new result;
  			new plyName[MAX_PLAYER_NAME];

			GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
			for(new i; i != MAX_VEHICLES; i++)
			{
				new dist = CheckPlayerDistanceToVehicle(6, playerid, i);
				if(dist)
				{
					result = i;
					counter++;
				}
			}
			if(LicenseCarsTest(result) || OttoCars(result))
			{
	 			return 1;
		   	}
			new pveh = GetVehicleModel(result);
			new newcar = GetPlayerVehicleID(playerid);
			switch(counter)
			{
			   	case 0:
			   	{
				   SendClientMessage(playerid, COLOR_RED,"ผิดพลาด"COL_WHITE": คุณไม่ได้อยู่ใกล้รถ !");
				   return 1;
   				}
			   	case 1:
			   	{
   					if(IsPlayerInAnyVehicle(playerid))
					{
   						SendClientMessage(playerid, COLOR_RED,"ผิดพลาด"COL_WHITE": คุณไม่สามารถงัดรถได้ ทั้งๆที่คุณอยู่ในรถ !");
  						return 1;
					}
					if(JackCars[playerid] >= 1)
 					{
   						SendClientMessage(playerid, COLOR_RED,"ผิดพลาด"COL_WHITE": กรุณารอสักครู่คุณพึ่งพยายามจะงัดไปโปรดลองใหม่ภายหลัง !");
						return 1;
  					}
    				if(VehicleJackLock[newcar] >= 1)
		   			{
 		    			SendClientMessage(playerid, COLOR_RED,"ผิดพลาด"COL_WHITE": รถคันนี้ถูกงัดไว้แล้ว !");
						return 1;
 					}
 					SetTimerEx("ResetJackCarTimer", 6000, 0, "i", playerid);
			   		SendClientMessage(playerid, COLOR_YELLOW, "*คุณกำลังงัดรถ");
			   		format(string, sizeof(string), "** %s ได้พยายามงัดรถ", sendername);
			   		GameTextForPlayer(playerid, "~w~Jacking vehicle ...",2000,3);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					new RandomJa;
					if(JackCarStart[playerid] == 1)
					{
				 		RandomJa = random(50);
				 		if(RandomJa >= 1 && RandomJa <= 10)
						{
				 			GetPlayerName(playerid, sendername, sizeof(sendername));
				 			SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถไม่สำเร็จ");
				   			GameTextForPlayer(playerid, "~w~Jack vehicle ~r~unsuccess...",2000,3);
							format(string, sizeof(string), "** %s งัดรถแต่ไม่สำเร็จ", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
						}
						else
						{
						 	PutPlayerInVehicle(playerid, pveh, 0);
						 	SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถสำเร็จ");
						 	GameTextForPlayer(playerid, "~w~Jack vehicle ~g~success...",1000,3);
						 	GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "** %s งัดรถยนต์ได้แล้ว", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
							VehicleJackLock[newcar] = 1;
						}
					}
					if(JackCarStart[playerid] == 2)
					{
					    RandomJa = random(50);
				 		if(RandomJa >= 1 && RandomJa <= 25)
						{
						    GetPlayerName(playerid, sendername, sizeof(sendername));
						    SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถไม่สำเร็จ");
				   			GameTextForPlayer(playerid, "~w~Jack vehicle ~r~unsuccess...",2000,3);
							format(string, sizeof(string), "** %s งัดรถแต่ไม่สำเร็จ", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
						}
						else
						{
						   	PutPlayerInVehicle(playerid, pveh, 0);
				            SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถสำเร็จ");
						 	GameTextForPlayer(playerid, "~w~Jack vehicle ~g~success...",1000,3);
						    GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "** %s งัดรถยนต์ได้แล้ว", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
							VehicleJackLock[newcar] = 1;
						}
					}
					if(JackCarStart[playerid] == 3)
					{
				 	   	RandomJa = random(50);
				 	   	if(RandomJa >= 1 && RandomJa <= 35)
						{
				 		   	GetPlayerName(playerid, sendername, sizeof(sendername));
				 		   	SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถไม่สำเร็จ");
				   			GameTextForPlayer(playerid, "~w~Jack vehicle ~r~unsuccess...",2000,3);
							format(string, sizeof(string), "** %s งัดรถแต่ไม่สำเร็จ", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
						}
						else
						{
						    PutPlayerInVehicle(playerid, pveh, 0);
				            SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถสำเร็จ");
						 	GameTextForPlayer(playerid, "~w~Jack vehicle ~g~success...",1000,3);
				 		   	GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "** %s งัดรถยนต์ได้แล้ว", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
							VehicleJackLock[newcar] = 1;
						}
					}
					if(JackCarStart[playerid] == 4)
					{
				 	   	RandomJa = random(50);
				 	  	if(RandomJa >= 1 && RandomJa <= 40)
						{
				 		   	GetPlayerName(playerid, sendername, sizeof(sendername));
				 		   	SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถไม่สำเร็จ");
				   			GameTextForPlayer(playerid, "~w~Jack vehicle ~r~unsuccess...",2000,3);
							format(string, sizeof(string), "** %s งัดรถแต่ไม่สำเร็จ", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
						}
						else
						{
						    PutPlayerInVehicle(playerid, pveh, 0);
				            SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถสำเร็จ");
						 	GameTextForPlayer(playerid, "~w~Jack vehicle ~g~success...",1000,3);
						    GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "** %s งัดรถยนต์ได้แล้ว", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
							VehicleJackLock[newcar] = 1;
						}
					}
					if(JackCarStart[playerid] == 5)
					{
					  	RandomJa = random(50);
				    	if(RandomJa >= 1 && RandomJa <= 45)
						{
						    GetPlayerName(playerid, sendername, sizeof(sendername));
						    SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถไม่สำเร็จ");
				   			GameTextForPlayer(playerid, "~w~Jack vehicle  ~r~unsuccess...",2000,3);
							format(string, sizeof(string), "** %s งัดรถแต่ไม่สำเร็จ", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
						}
						else
						{
							PutPlayerInVehicle(playerid, pveh, 0);
				            SendClientMessage(playerid, COLOR_YELLOW, "*คุณงัดรถสำเร็จ");
						 	GameTextForPlayer(playerid, "~w~Jack vehicle ~g~success...",1000,3);
						    GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "** %s งัดรถได้แล้ว", sendername);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							JackCars[playerid] = 1;
							VehicleJackLock[newcar] = 1;
						}
					}
					return 1;
      			}
      			default:
      			{
      				SendClientMessage(playerid, COLOR_RED,"ผิดพลาด"COL_WHITE": คุณไม่ได้อยู่ใกล้รถ !");
      				return 1;
      			}
		    }
		}
this code onplayerentervehicle if i can do disable lock

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
//==================== Official Car ============================================//
    if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1)
	{
		if (CopsCars(vehicleid) && !ispassenger)
		{
			if(VehicleJackLock[vehicleid] >= 1)
			{
		        return 1;
		    }
		    else
		    {
		        new Float:X, Float:Y, Float:Z;
				GetPlayerPos(playerid, X, Y, Z);
				SetPlayerPos(playerid, X, Y, Z);
				//PlayerPlaySound(playerid, 1085, X, Y, Z);
				return 1;
		    }
		}
	}
       return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)