02.07.2009, 23:15
I built a Car Ownership System on my RP mode and while I compile the mode no error
but while I enter the game I got crash on the start
this is the system
Top of the mode
new public
On the public "OnPlayerStateChange"
on "OnGameModeInit"
Sorry about my English
but while I enter the game I got crash on the start
this is the system
Top of the mode
Код:
enum ocInfo
{
ocOwner[64],
ocVeh,
Float:ocPosX,
Float:ocPosY,
Float:ocPosZ,
Float:ocPosA,
ocColor1,
ocColor2,
ocKey,
};
new OCarInfo[5][ocInfo];
Код:
public LoadCars()
{
new arrCoords[19][64];
new strFromFile2[256];
new File: file = fopen("OwnCars.cfg", io_read);
if(file)
{
new idx;
while (idx < sizeof(OCarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, '|');
OCarInfo[idx][ocKey] = strval(arrCoords[0]);
strmid(OCarInfo[idx][ocOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
OCarInfo[idx][ocVeh] = strval(arrCoords[2]);
OCarInfo[idx][ocPosX] = floatstr(arrCoords[3]);
OCarInfo[idx][ocPosY] = floatstr(arrCoords[4]);
OCarInfo[idx][ocPosZ] = floatstr(arrCoords[5]);
OCarInfo[idx][ocPosA] = floatstr(arrCoords[6]);
OCarInfo[idx][ocColor1] = strval(arrCoords[7]);
OCarInfo[idx][ocColor2] = strval(arrCoords[8]);
idx++;
}
fclose(file);
}
return 1;
}
Код:
if(newstate==PLAYER_STATE_DRIVER)
{
new PlayerName[100]; GetPlayerName(playerid,PlayerName,30);
if(OCarInfo[vehicle][ocOwner] == 1)
{
format(string,sizeof(string),"[ Vehicle Owner: %s ]", OCarInfo[vehicle][ocOwner] );
SendClientMessage(playerid,0x7E5F2FFF,string);
}
}
if(newstate==PLAYER_STATE_PASSENGER)
{
if(OCarInfo[vehicle][ocOwner] == 1)
{
format(string,sizeof(string),"[ Vehicle Owner: %s ]", OCarInfo[vehicle][ocOwner] );
SendClientMessage(playerid,0x7E5F2FFF,string);
}
}
Код:
for(new o =0; o<sizeof(OCarInfo); o++)
{
CreateVehicle(OCarInfo[o][ocVeh],OCarInfo[o][ocPosX],OCarInfo[o][ocPosY],OCarInfo[o][ocPosZ],OCarInfo[o][ocPosA],-1,-1,-1);
}


