i cant get this loop functioning as i want...
#5

i now have changed it to this, and it works, but not exactly as i want it.

if i do /v park at for example vehicle 2(OtherCars[playerid][2]) than it says it like this:
This aint your vehicle.
This aint your vehicle.
vehicle successfully respawnd.
This aint your vehicle.

it shouldnt say those "this aint your car" messages at all, just the "vehicle respawned" message... whats wrong with this code:

pawn Code:
CMD:park(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You aren't in any vehicle.");
    new vehicleid = GetPlayerVehicleID(playerid);
    for(new i; i < sizeof(OtherCars[]); i++)
    {
        if(vehicleid == OtherCars[playerid][i])
        {
            new Float:x, Float:y, Float:z, Float:angle;
            GetVehiclePos(OtherCars[playerid][i], x, y, z);
            GetVehicleZAngle(OtherCars[playerid][i], angle);
            SaveFloatToCarSlot(playerid, i, "XSpawn", x );
            SaveFloatToCarSlot(playerid, i, "YSpawn", y );
            SaveFloatToCarSlot(playerid, i, "ZSpawn", z );
            SaveFloatToCarSlot(playerid, i, "ASpawn", angle );
            SaveVehComponents(playerid, OtherCars[playerid][i], i);
            foreach(Player, p)
            {
                if(IsPlayerInVehicle(playerid, vehicleid))
                {
                    if(p != playerid && GetPlayerState(p) == PLAYER_STATE_DRIVER)
                    {
                        RemovePlayerFromVehicle(p);
                    }
                }
            }
            SetVehiclePosZAngle( OtherCars[playerid][i], x, y, z, angle );
            PutPlayerInVehicle(playerid, OtherCars[playerid][i], 0);
            SendClientMessage(playerid, COLOR_WHITE, "Car Succesfully Parked.");
        }
        else SendClientMessage(playerid, COLOR_RED, "This ain't your car.");
    }
    return 1;
}
thanks
Reply


Messages In This Thread
i cant get this loop functioning as i want... - by Apenmeeuw - 22.03.2013, 21:18
Re: i cant get this loop functioning as i want... - by Vince - 22.03.2013, 21:25
Re: i cant get this loop functioning as i want... - by Apenmeeuw - 22.03.2013, 22:20
Re: i cant get this loop functioning as i want... - by [ABK]Antonio - 22.03.2013, 22:24
Re: i cant get this loop functioning as i want... - by Apenmeeuw - 22.03.2013, 22:27
Re: i cant get this loop functioning as i want... - by [ABK]Antonio - 22.03.2013, 22:34
Re: i cant get this loop functioning as i want... - by Apenmeeuw - 23.03.2013, 07:45

Forum Jump:


Users browsing this thread: 3 Guest(s)