Personal cars not showing up
#1

I tried to make something if you write /stats you can see your personal cars details,id,name etc.
Those things show up but without the actual names..its blank.


PHP код:
    public ShowCars(playerid,targetid)
    {
        if(
IsPlayerConnected(playerid) && IsPlayerConnected(targetid))
        {
                        new 
string[128];
                        new 
carkey PlayerInfo[targetid][pPcarkey];
                        new 
carkey2 PlayerInfo[targetid][pPcarkey2];
                        new 
carkey3 PlayerInfo[targetid][pPcarkey3];
                        if (
PlayerInfo[targetid][pPcarkey] != -1)
                        {
                            
format(stringsizeof(string), "» Vehicul personal 1: VehID:%d • VehColor1:%d • VehColor2:%d • Model:%s"PlayerInfo[targetid][pPcarkey], CarInfo[carkey][cColorOne], CarInfo[carkey][cColorTwo], CarInfo[carkey][cDescription]);
                            
SendClientMessage(targetid0x35F31AE4string);
                        }
                        if (
PlayerInfo[targetid][pPcarkey2] != -1)
                        {
                            
format(stringsizeof(string), "» Vehicul personal 2: VehID:%d • VehColor1:%d • VehColor2:%d • Model:%s"PlayerInfo[targetid][pPcarkey2], CarInfo[carkey2][cColorOne], CarInfo[carkey2][cColorTwo], CarInfo[carkey2][cDescription]);
                            
SendClientMessage(targetid0x35F31AE4string);//0x0480FBC8
                        
}
                        if (
PlayerInfo[targetid][pPcarkey3] != -1)
                        {
                            
format(stringsizeof(string), "» Vehicul personal 3: VehID:%d • VehColor1:%d • VehColor2:%d • Model:%s"PlayerInfo[targetid][pPcarkey3], CarInfo[carkey3][cColorOne], CarInfo[carkey3][cColorTwo], CarInfo[carkey3][cDescription]);
                            
SendClientMessage(targetid0x35F31AE4string);
                        }
                    }
                } 
It just shows Vehicul personal 3: Vehid: Vehcolor: etc...
Thanks in advance for tips.
Reply
#2

Just have a global array with all vehicles' name and retrieve it in the code.

http://forum.sa-mp.com/showpost.php?...06&postcount=4

But modifying to prevent run time errors:
pawn Код:
GetVehicleName(vehicleid)
{
    new String[32] = "N/A", modelid = GetVehicleModel(vehicleid);
    if (modelid) strcat((String[0] = EOS, String), VehicleNames[modelid - 400], sizeof (String));
    return String;
}
Usage:
pawn Код:
GetVehicleName(PlayerInfo[targetid][pPcarkey])
Reply
#3

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)