Why is this wrong?!
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        new id = GetVehicleID(vehicleid);
        if(IsValidVehicle(id) && VehicleCreated[id] = VEHICLE_PLAYER)
        {
            if(PlayerName(playerid) =! VehicleOwner[id])
            {
                new msg[128];
                format(msg, sizeof(msg), "You don't have the keys of this vehicle");
                SendClientMessage(playerid, COLOR_GREY, msg);
                RemovePlayerFromVehicle(playerid);
            }
            else
            {
            SendClientMessage(playerid, COLOR_GREY, "This vehicle is yours.");
            }
        }
    }
    return 1;
}
Try this.
That will just create another issue since his first operator (==) was actually correct.

OT: You used =! while the operator is !=.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        new id = GetVehicleID(vehicleid);
        if(IsValidVehicle(id) && VehicleCreated[id] == VEHICLE_PLAYER)
        {
            if(PlayerName(playerid) != VehicleOwner[id])
            {
                SendClientMessage(playerid, COLOR_GREY, "You don't have the keys of this vehicle!");
                RemovePlayerFromVehicle(playerid);
            }

            else return SendClientMessage(playerid, COLOR_GREY, "This vehicle is yours.");
        }
    }
   
    return 1;
}
EDIT: Optimised your code abit

See: https://sampwiki.blast.hk/wiki/Control_Structures#Operators
Reply


Messages In This Thread
Why is this wrong?! - by alanhutch - 27.07.2014, 17:43
Re: Why is this wrong?! - by DaniceMcHarley - 27.07.2014, 17:46
Re: Why is this wrong?! - by d3ll - 27.07.2014, 17:49
Re: Why is this wrong?! - by Champ - 27.07.2014, 17:53
Re: Why is this wrong?! - by Dignity - 27.07.2014, 17:53

Forum Jump:


Users browsing this thread: 3 Guest(s)