21.02.2011, 10:25
Well your code really doesn't make any sense, there's several problems with it. First of all, you're creating a string for the playername with a length of MAX_PLAYER_NAME (24), and then you're specifying the length of the string as 30 in your GetPlayerName function? You should change that to:
The next part doesn't make sense at all, this is assuming that CarOwner[playerid] has stored the ID of the vehicle that they own. So why do you need a loop at all to find what car they own? Then you're storing the ID of the vehicle in a float and storing it as the health of the vehicle!? Also you're trying to store the return value of the GetVehicleZAngle function, which won't work since the return value is not the angle.
Either way I suggest you store the ID of the vehicle they own in the CarOwner variable. Then you can simply do this:
Doesn't that make more sense? Or am I missing the point of your code?
pawn Код:
GetPlayerName(playerid, pname,30);
Either way I suggest you store the ID of the vehicle they own in the CarOwner variable. Then you can simply do this:
pawn Код:
if(dini_Exists(file))
{
new Float:Healthh, Float:angl;
GetVehicleHealth(CarOwner[playerid],Healthh);
GetVehicleZAngle(CarOwner[playerid],angl);
GetVehiclePos(CarOwner[playerid],x,y,z);
dini_IntSet(file,"LastID", CarOwner[playerid]);
dini_IntSet(file,"CModel", CarInfo[CarOwner[playerid]][CModel]);
dini_FloatSet(file,"PosX", x);
dini_FloatSet(file,"PosY", y);
dini_FloatSet(file,"PosZ", z);
dini_FloatSet(file,"Angle", angl);
dini_FloatSet(file,"Health", Healthh);
DestroyVehicle(CarOwner[playerid]);
}