Why Why Why ?? WTF
#1

I got a gate that should open when press spacebar but this dosn't happen (( Can any one tell me why? This is my script [public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)]

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new PdOpen;
	new AmOpen;
	new bramapd1;
	new bramapd2;
	new bramaam;
	bramapd1 = CreateObject(13028, 618.121155, -601.515076, 17.850210, 0.0000, 0.0000, 180.0000);
	bramapd2 = CreateObject(13028, 618.132141, -596.973572, 17.850210, 0.0000, 0.0000, 180.0000);
	bramaam = CreateObject(975, 327.172607, -39.189079, 2.024162, 0.0000, 0.0000, 0.0000);
  if ((newkeys==KEY_SPRINT) || (newkeys==KEY_BRAKE))
	{
		if(PlayerToPoint(2.0,playerid, 618.161255, -594.538818, 17.771645) || PlayerToPoint(2.0,playerid, 616.606628, -594.804810, 17.892050) && GetPlayerState(playerid) == 1)
		{
			if(PdOpen == 0)
			{
				MoveObject(bramapd1, 618.121155, -601.515076, 14.275265, 4);
				MoveObject(bramapd2, 618.132141, -596.973572, 14.275265, 4);
        PdOpen = 1;
				return 1;
			}
			else if(PdOpen == 1)
			{
				MoveObject(bramapd1, 618.121155, -601.515076, 17.850210, 4);
				MoveObject(bramapd2, 618.132141, -596.973572, 17.850210, 4);
			  PdOpen = 0;
				return 1;
			}
		}
		else if(PlayerToPoint(2.0,playerid, 322.511871, -40.577465, 2.167633) || PlayerToPoint(2.0,playerid,331.814301, -37.939693, 1.994525) && GetPlayerState(playerid) == 1)
		{
			if(AmOpen == 0)
			{
				MoveObject(bramaam, 318.274780, -39.189079, 2.024162, 4);
        AmOpen = 1;
				return 1;
			}
			else if(AmOpen == 1)
			{
				MoveObject(bramaam,327.172607,-39.189079,2.024162, 4);
			  AmOpen = 0;
				return 1;
			}
		}
	}
	if ((newkeys==KEY_ACTION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
	{
		if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
		{
			SendClientMessage(playerid,COLOR_LIGHTRED,"Prуbujesz podczepić pojazd");
			new Float:pX,Float:pY,Float:pZ;
			GetPlayerPos(playerid,pX,pY,pZ);
			new Float:vX,Float:vY,Float:vZ;
			new Found=0;
			new vid=0;
			while((vid<MAX_VEHICLES)&&(!Found))
			{
			vid++;
			GetVehiclePos(vid,vX,vY,vZ);
			if ((floatabs(pX-vX)<7.0)&&(floatabs(pY-vY)<7.0)&&(floatabs(pZ-vZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
			{
				Found=1;
				if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
				{
					DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
				}
					AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
					SendClientMessage(playerid,COLOR_LIGHTRED,"Pojazd podczepiony");
				}
			}
			if (!Found)
			{
				SendClientMessage(playerid,COLOR_LIGHTRED,"Nie ma w pobliżu żadnych samochodуw.");
			}
		}
	}
	return 0;
}
Reply
#2

there must be a reason why it's not working i had it working before but i lost that map ((
Reply
#3

Replace:
Код:
if ((newkeys==KEY_SPRINT) || (newkeys==KEY_BRAKE))
With:
Код:
if(newkeys == KEY_SPRINT || newkeys == KEY_BRAKE)
But why are you using CreateObject? now there will be an object created when anybody press any key.
Reply


Forum Jump:


Users browsing this thread: