SA-MP Forums Archive
What am i doing wrong? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What am i doing wrong? (/showthread.php?tid=95881)



What am i doing wrong? - International - 05.09.2009

Hey guys what i want this to do is when the person enters a vehicle it tells them the ID of the vehicle and the name of the vehicle (ye si have vehicle names at top of my script in correct order)

Help will be appreciated, Also i dont get any errors.

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            {
                new vehid;
                vehid = GetVehicleModel(GetPlayerVehicleID(playerid));
                new string[100];
                format(string, 100, "Vehicle ID : %d Vehicle Name : %s" ,vehid, VehicleNames);
                SendClientMessage(playerid, COLOR_WHITE,string);
            }
            return 1;
        }
    }
    return 0;
}



Re: What am i doing wrong? - Clavius - 05.09.2009

First, you don't need to do an IsPlayerInAnyVehicle check in the OnPlayerEnterVehicle callback (think it over) !
The vehicle ID and vehicle model ID are not the same, but i assume you mean the model id.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new
        vehid,
        string[64];
    vehid = GetVehicleModel(vehicleid);
    format(string, 100, "Model ID: %d Vehicle Name : %s" ,vehid, VehicleNames[vehid - 400]);
    SendClientMessage(playerid, COLOR_WHITE,string);
    return 1;
}



Re: What am i doing wrong? - International - 05.09.2009

Thank you so much!!