/mycars Cmd Dont Load
#1

I Add /mycars Cmd TO AVS Vehicle FilterScript It compiles Succssfully BuT,It Doesent Load The Cars when player uses the cmd in the game.
PHP код:
CMD:mycars(playeridparams[])
{
    new 
vehicleid GetPlayerVehicleID(playerid);
    new 
filename[64], line[256];
    
format(filenamesizeof(filename), VEHICLE_FILE_PATH "v%d.ini"vehicleid);
    new 
File:handle fopen(filenameio_write);
    
format(linesizeof(line), "Created=%d\r\n"VehicleCreated[vehicleid]); fwrite(handleline);
    
format(linesizeof(line), "Model=%d\r\n"VehicleModel[vehicleid]); fwrite(handleline);
    
format(linesizeof(line), "Colors=%d,%d\r\n"VehicleColor[vehicleid][0], VehicleColor[vehicleid][1]); fwrite(handleline);
    
format(linesizeof(line), "Owner=%s\r\n"VehicleOwner[vehicleid]); fwrite(handleline);
    
format(linesizeof(line), "NumberPlate=%s\r\n"VehicleNumberPlate[vehicleid]); fwrite(handleline);
    
format(linesizeof(line), "Value=%d\r\n"VehicleValue[vehicleid]); fwrite(handleline);
    
format(linesizeof(line), "Lock=%d\r\n"VehicleLock[vehicleid]); fwrite(handleline);
    
fclose(handle);
    if(
IsPlayerConnected(playerid))
    {
    new 
string[256];
    new 
carkey PlayerInfo[playerid][pPcarkey];
    new 
carkey2 PlayerInfo[playerid][pPcarkey2];
    new 
carkey3 PlayerInfo[playerid][pPcarkey3];
    if (
PlayerInfo[playerid][pPcarkey] != -1)
    {
    
format(stringsizeof(string), "1| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]"CarInfo[carkey][Model], CarInfo[carkey][Colors], CarInfo[Owner], CarInfo[carkey][Lock]);
    
SendClientMessage(playeridCOLOR_GRAD5,string);
    }
    if (
PlayerInfo[playerid][pPcarkey2] != -1)
    {
    
format(stringsizeof(string), "2| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]"CarInfo[carkey2][Model], CarInfo[carkey][Colors], CarInfo[Owner], CarInfo[carkey][Lock]);
    
SendClientMessage(playeridCOLOR_GRAD5,string);
    }
    if (
PlayerInfo[playerid][pPcarkey3] != -1)
    {
    
format(stringsizeof(string), "3| VehModel:[%s] VehValue:[%d] VehColor1:[%d] VehColor2:[%d] VehLocked:[%d]"CarInfo[carkey3][Model], CarInfo[carkey][Colors], CarInfo[Owner], CarInfo[carkey][Lock]);
    
SendClientMessage(playeridCOLOR_GRAD5,string); }
    }
    return 
1;

Reply
#2

There are all too many bits of code to consider when you have a loading issue with someone else's script. I would suggest posting in that thread rather, where it is likely that someone else has experienced the problem or at the very least you can get help with someone who is familiar with the script.
Reply
#3

here i change it a little but it still not loading the vehicle why?

Quote:

CMD:mycars(playerid, params[])
{
new string[64];
new File:handle, count;
new filename[64], line[256], s, key[64];
for(new i=1; i < MAX_DVEHICLES; i++)
{
format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);
if(!fexist(filename)) continue;
handle = fopen(filename, io_read);
while(fread(handle, line))
{
StripNL(line);
s = strfind(line, "=");
if(!line[0] || s < 1) continue;
strmid(key, line, 0, s++);
if(strcmp(key, "Created") == 0) VehicleCreated[i] = strval(line[s]);
else if(strcmp(key, "Model") == 0) VehicleModel[i] = strval(line[s]);
else if(strcmp(key, "Pos") == 0) sscanf(line[s], "p,ffff", VehiclePos[i][0], VehiclePos[i][1],
VehiclePos[i][2], VehiclePos[i][3]);
else if(strcmp(key, "Colors") == 0) sscanf(line[s], "p,dd", VehicleColor[i][0], VehicleColor[i][1]);
else if(strcmp(key, "Interior") == 0) VehicleInterior[i] = strval(line[s]);
else if(strcmp(key, "VirtualWorld") == 0) VehicleWorld[i] = strval(line[s]);
else if(strcmp(key, "Owner") == 0) strmid(VehicleOwner[i], line, s, sizeof(line));
else if(strcmp(key, "NumberPlate") == 0) strmid(VehicleNumberPlate[i], line, s, sizeof(line));
else if(strcmp(key, "Value") == 0) VehicleValue[i] = strval(line[s]);
else if(strcmp(key, "Lock") == 0) VehicleLock[i] = strval(line[s]);
else if(strcmp(key, "Alarm") == 0) VehicleAlarm[i] = strval(line[s]);
else if(strcmp(key, "Paintjob") == 0) VehiclePaintjob[i] = strval(line[s]);
else
{
for(new t=0; t < sizeof(VehicleTrunk[]); t++)
{
format(string, sizeof(string), "Trunk%d", t+1);
if(strcmp(key, string) == 0) sscanf(line[s], "p,dd", VehicleTrunk[i][t][0], VehicleTrunk[i][t][1]);
}
for(new m=0; m < sizeof(VehicleMods[]); m++)
{
format(string, sizeof(string), "Mod%d", m);
if(strcmp(key, string) == 0) VehicleMods[i][m] = strval(line[s]);
}
}
}
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pPcarkey] != -1)
{
format(string, sizeof(string), "1| VehModel:[%d] VehValue:[%d] VehColors:[%d,%d] VehOwner:[%s] VehLocked:[%d]", CarInfo[Model], CarInfo[Colors], CarInfo[Owner], CarInfo[Lock]);
SendClientMessage(playerid, COLOR_GRAD5,string);
}
if (PlayerInfo[playerid][pPcarkey2] != -1)
{
format(string, sizeof(string), "2 VehModel:[%d] VehValue:[%d] VehColors:[%d,%d] VehOwner:[%s] VehLocked:[%d]", CarInfo[Model], CarInfo[Colors], CarInfo[Owner], CarInfo[Lock]);
SendClientMessage(playerid, COLOR_GRAD5,string);
}
if (PlayerInfo[playerid][pPcarkey3] != -1)
{
format(string, sizeof(string), "3| VehModel:[%d] VehValue:[%d] VehColors:[%d,%d] VehOwner:[%s] VehLocked:[%d]", CarInfo[Model], CarInfo[Colors], CarInfo[Owner], CarInfo[Lock]);
SendClientMessage(playerid, COLOR_GRAD5,string); }
}
fclose(handle);
if(VehicleCreated[i]) count++;
}
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)