SA-MP Forums Archive
GetVehicleModel Debug error. - 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)
+--- Thread: GetVehicleModel Debug error. (/showthread.php?tid=442297)



GetVehicleModel Debug error. - dannyk0ed - 06.06.2013

Hello.
Im trying to create a /policepark system but there is a problem with one system.
GetVehicleModel.
pawn Код:
CMD:policepark(playerid, parmas[])
{
    if(IsACop(playerid) || PlayerInfo[playerid][pAdmin] >= 2 || ModDuty[playerid] == 1)
    {
        new veh = GetPlayerVehicleID(playerid);
        new cm = GetVehicleModel(veh);
        new
            Float:a,
            string[180],
            Float:dPos[4],
            cowner = CarInfo[veh][cUid]
        ;
        SCM(playerid, -1, "Passes");
        format(string, sizeof(string),"Vehicle name = %s",GetVehicleModel(veh));
        SCM(playerid, -1, string);
        GetVehiclePos(veh, dPos[0], dPos[1], dPos[2]);
        GetVehicleZAngle(veh, a);
        if(cm == PlayerInfo[cowner][pPcarkey])
        {
            PlayerInfo[cowner][pC1X] = dPos[0];
            PlayerInfo[cowner][pC1Y] = dPos[1];
            PlayerInfo[cowner][pC1Z] = dPos[2];
            PlayerInfo[cowner][pC1A] = a;
            SCM(playerid, -1, "Debug Test");
        }
        else if(cm == PlayerInfo[cowner][pPcarkey2])
        {
            PlayerInfo[cowner][pC2X] = dPos[0];
            PlayerInfo[cowner][pC2Y] = dPos[1];
            PlayerInfo[cowner][pC2Z] = dPos[2];
            PlayerInfo[cowner][pC2A] = a;
            SCM(playerid, -1, "Debug Test");
        }
        else if(cm == PlayerInfo[cowner][pPvipcar])
        {
            PlayerInfo[cowner][pC3X] = dPos[0];
            PlayerInfo[cowner][pC3Y] = dPos[1];
            PlayerInfo[cowner][pC3Z] = dPos[2];
            PlayerInfo[cowner][pC3A] = a;
            SCM(playerid, -1, "Debug Test");
        }
        else
        {
            SCM(playerid, COLOR_WHITE, " You can only park your own car.");
        }
    }
    return 1;
}
This is what it shows afterwards.
Код:
[16:02:36] Passes

[16:02:36] Vehicle name = !licepark

[16:02:36] Debug Test



Re: GetVehicleModel Debug error. - Vince - 06.06.2013

GetVehicleModel only returns an integer value between 400 and 611 indicating the vehicle's modelid (duh!). You need an array of vehicle names.


Re: GetVehicleModel Debug error. - dannyk0ed - 06.06.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
GetVehicleModel only returns an integer value between 400 and 611 indicating the vehicle's modelid (duh!). You need an array of vehicle names.
Haha well.

Mistake on my end.

I used GetVehicleModel instead of my array VehicleNames

Thanks.