Personal cars not showing up - 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: Personal cars not showing up (
/showthread.php?tid=575856)
Personal cars not showing up -
PepsiCola23 - 30.05.2015
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(string, sizeof(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(targetid, 0x35F31AE4, string);
}
if (PlayerInfo[targetid][pPcarkey2] != -1)
{
format(string, sizeof(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(targetid, 0x35F31AE4, string);//0x0480FBC8
}
if (PlayerInfo[targetid][pPcarkey3] != -1)
{
format(string, sizeof(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(targetid, 0x35F31AE4, string);
}
}
}
It just shows Vehicul personal 3: Vehid: Vehcolor: etc...
Thanks in advance for tips.
Re: Personal cars not showing up -
Konstantinos - 30.05.2015
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])
Re: Personal cars not showing up -
PepsiCola23 - 30.05.2015
Thanks