CAR LOADING PROBLEM.
#1

Hello,again.I need help with my loading cars script here is it:

OnGameModeInit()

CarSave();

forward CarSave();

public CarSave()
{
for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
{
new files [128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format( files, 60, "saves/cars/%s.ini",name);
if(!fexist(files))
{
return 1;
}
print("Masinos Uzkrautos");
PlayerData[ playerid ][ CModelis ] = dini_Int( files, "Modelis");
PlayerData[ playerid ][ pX ] = dini_Float( files, "PosX");
PlayerData[ playerid ][ pY ] = dini_Float( files, "PosY");
PlayerData[ playerid ][ pZ ] = dini_Float( files, "PosZ");
PlayerData[ playerid ][ pA ] = dini_Float( files, "PosA");
VehicleInfo[ playerid ][ Color1 ] = dini_Int( files, "Color1");
VehicleInfo[ playerid ][ Color2 ] = dini_Int( files, "Color2");
new carid = CreateVehicle(PlayerData[ playerid ][ CModelis ], PlayerData[ playerid ][ pX ], PlayerData[ playerid ][ pY ], PlayerData[ playerid ][ pZ ],PlayerData[ playerid ][ pA ], VehicleInfo[ playerid ][Color1], VehicleInfo[ playerid ][Color2], -1);
PlayerData[playerid][pcar]=carid;
vehicleDB[carid][Uzrakinta]=true;
new string[128];
format(string,128,"Model:%d,X:%f,Y:%f,Z:%f,A:%f",P layerData[ playerid ][ CModelis ], PlayerData[ playerid ][ pX ], PlayerData[ playerid ][ pY ], PlayerData[ playerid ][ pZ ], PlayerData[ playerid ][ pA ]);
print(string);

All saves good here is a picture:



But when i start server i don't get this message:

format(string,128,"Model:%d,X:%f,Y:%f,Z:%f,A:%f",P layerData[ playerid ][ CModelis ], PlayerData[ playerid ][ pX ], PlayerData[ playerid ][ pY ], PlayerData[ playerid ][ pZ ], PlayerData[ playerid ][ pA ]);
print(string);



Whats can be wrong?
Reply
#2

When the server starts, there are no players connected, thus GetPlayerName returns 0 (or an empty string, not sure).
Reply
#3

Then how make other way?(or how to fix this way).Thanks for answers
Reply
#4

use vehicleid
Reply
#5

but if one player buy vehicle by id 522 and other player will buy 522 then file will overwrite
Reply
#6

any answers?
Reply


Forum Jump:


Users browsing this thread: