28.02.2011, 19:58
The correct may to this code work would be by put all vehicles info from a player on dialog, but it's just working once ( for the first ).
I bought two vehicles for test if that would work twice, but just works once. Both files are having my name (owner), but seem the strcmp doesn't detects
Uploaded with ImageShack.us
pawn Код:
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Car system ! ! ! ! ! ! ! ! ! ! ! ! ! ! !");
print("--------------------------------------\n");
Loop(h, MAX_VEHICLES)
{
format(file,sizeof(file),local,h);
if(INI_Exist(file))
{
INI_Open(file);
INI_ReadString(Vehicle[h][Owner], "Owner", MAX_PLAYER_NAME);
INI_ReadString(Vehicle[h][Plate], "Plate", 32);
Vehicle[h][Model] = INI_ReadInt("Model");
Vehicle[h][Color1] = INI_ReadInt("Color1");
Vehicle[h][Color2] = INI_ReadInt("Color2");
Vehicle[h][ID] = INI_ReadInt("ID");
Vehicle[h][x] = INI_ReadFloat("x");
Vehicle[h][y] = INI_ReadInt("y");
Vehicle[h][z] = INI_ReadInt("z");
CreateVehicle(Vehicle[h][Model],Vehicle[h][x],Vehicle[h][y],Vehicle[h][z],Vehicle[h][a],Vehicle[h][Color1],Vehicle[h][Color2],500000);
Owned[h] = 1;
SetVehicleNumberPlate(h,Vehicle[h][Plate]);
hcount++;
}
}
printf(" * Amount of loaded vehicles: %d * ",hcount);
return 1;
}
pawn Код:
CMD:status(playerid, params[])
{
new string[200];
new model;
Loop(v, MAX_VEHICLES)
{
if(!strcmp(Vehicle[v][Owner],GetMyName(playerid),true))
{
format(string,sizeof(string),""#red"Name: %s | Model: %d | ID: %d\n",VehicleNames[Vehicle[v][Model]-400],Vehicle[v][Model],Vehicle[v][ID]);
return ShowPlayerDialog(playerid,ME_DIALOG,DIALOG_STYLE_MSGBOX,""#green"Your vehicles",string,"Ok","");
}
}
return 1;
// ShowPlayerDialog(playerid,NULL_DIALOG,DIALOG_STYLE_MSGBOX,""#green"SERVER INFO:","You do "#red"not "#green"own any vehicles",".","");
}
Uploaded with ImageShack.us