fix the bug
#1

Fix the bug

Код:
	new Float:xtram1, Float:ytram1, Float:ztram1;
	new Float:xtram2, Float:ytram2, Float:ztram2;
	if(strcmp(cmdtext, "/entertram", true) == 0)
	{
		GetVehiclePos(TramCar1, xtram1, ytram1, ztram1);
		GetVehiclePos(TramCar2, xtram2, ytram2, ztram2);
		if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1) && IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
		{
			if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
			{
				PutPlayerInVehicle(playerid, TramCar1, 0);
			}
			if(IsPlayerInRangeOfPoint(playerid, 6, xtram2, ytram2, ztram2))
			{
				PutPlayerInVehicle(playerid, TramCar2, 0);
			}
		}
		else
		{
			SendClientMessage(playerid, 0x000000FF, "You are not to tram.");
		}
		return 1;
	}
Reply
#2

Say the magic word!
Reply
#3

Quote:
Originally Posted by Join7
Посмотреть сообщение
Fix the bug
Код:
	new Float:xtram1, Float:ytram1, Float:ztram1;
	new Float:xtram2, Float:ytram2, Float:ztram2;
	if(strcmp(cmdtext, "/entertram", true) == 0)
	{
		GetVehiclePos(TramCar1, xtram1, ytram1, ztram1);
		GetVehiclePos(TramCar2, xtram2, ytram2, ztram2);
		if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1) && IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
		{
			if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
			{
				PutPlayerInVehicle(playerid, TramCar1, 0);
			}
			if(IsPlayerInRangeOfPoint(playerid, 6, xtram2, ytram2, ztram2))
			{
				PutPlayerInVehicle(playerid, TramCar2, 0);
			}
		}
		else
		{
			SendClientMessage(playerid, 0x000000FF, "You are not to tram.");
		}
		return 1;
	}

lol, anyway ..

pawn Код:
new Float:xtram1, Float:ytram1, Float:ztram1;
    new Float:xtram2, Float:ytram2, Float:ztram2;
    if(strcmp(cmdtext, "/entertram", true) == 0)
    {
        GetVehiclePos(TramCar1, xtram1, ytram1, ztram1);
        GetVehiclePos(TramCar2, xtram2, ytram2, ztram2);
        if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1) || IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
        {
            if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
            {
                PutPlayerInVehicle(playerid, TramCar1, 0);
            }
            if(IsPlayerInRangeOfPoint(playerid, 6, xtram2, ytram2, ztram2))
            {
                PutPlayerInVehicle(playerid, TramCar2, 0);
            }
        }
        else
        {
            SendClientMessage(playerid, 0x000000FF, "You are not to tram.");
        }
        return 1;
    }

This:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1) && IsPlayerInRangeOfPoint(playerid, 6, xtram1, ytram1, ztram1))
Means if the player is in range of the first vehicle position and the second vehicle position at the same time proccess to the code, therefore, I changed the "&&" into " || " which means 'or' .. so basically now when a player excutes the command, if hes in range of any of both vehicles he'll be put in the vehicle.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)