OnVehicleDeath code
#1

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
 for(new i=0; i<MAX_PLAYERS; i++)
 {
  new str[255],str1[255];
  new giveplayer[MAX_PLAYER_NAME];
  new name[MAX_PLAYER_NAME];
  GetPlayerName(i, name, sizeof(name));
  format(str1, sizeof(str1), "Insurances/%s.ini", VehicleInfo[vehicleid][vOwner]);
  printf("Insurances/%s.ini", VehicleInfo[vehicleid][vOwner]);
  if(dini_Exists(str1))
  {
     printf("Search for..");
     format(str, sizeof(str), "You destroy %s's vehicle. %d | %d", VehicleInfo[vehicleid][vOwner], dini_Int(str1, "Vehicle1"), vehicleid);
     SendClientMessageToAll(COLOR_LIGHTRED, str);
     if(dini_Int(str1, "Vehicle1") == vehicleid)
     {
        new ins = dini_Int(str1, "Ins1");
        insurance1 = ins-1;
        dini_IntSet(str1, "Ins1", insurance1);
         printf("Success");
         if(strcmp(VehicleInfo[vehicleid][vOwner],name, true ) == 0 )
         {
          format(str, sizeof(str), "You destroy %s's vehicle. %d insurance left", VehicleInfo[vehicleid][vOwner], insurance1);
          SendClientMessage(i, COLOR_LIGHTRED, str);
          printf("Success2");
         }
     }
     if(dini_Int(str1, "Vehicle2") == vehicleid)
     {
         new ins = dini_Int(str1, "Ins2");
        insurance2 = ins-1;
        dini_IntSet(str1, "Ins2", insurance2);
         printf("Success");
        if(strcmp(VehicleInfo[vehicleid][vOwner],name, true ) == 0 )
        {
        format(str, sizeof(str), "You destroy %s's vehicle. %d insurance left", VehicleInfo[vehicleid][vOwner], insurance2);
        SendClientMessage(i, COLOR_LIGHTRED, str);
        printf("Success2");
        }
     }
     if(dini_Int(str1, "Vehicle3") == vehicleid)
     {
        new ins = dini_Int(str1, "Ins3");
        insurance3 = ins-1;
        dini_IntSet(str1, "Ins3", insurance3);
        printf("Success2");
        if(strcmp(VehicleInfo[vehicleid][vOwner],name, true ) == 0 )
        {
        format(str, sizeof(str), "You destroy %s's vehicle. %d insurance left", VehicleInfo[vehicleid][vOwner], insurance3);
        SendClientMessage(i, COLOR_LIGHTRED, str);
        printf("Success");
        }
     }
     if(dini_Int(str1, "Vehicle4") == vehicleid)
     {
        new ins = dini_Int(str1, "Ins4");
        insurance4 = ins-1;
        dini_IntSet(str1, "Ins4", insurance4);
        printf("Success");
        if(strcmp(VehicleInfo[vehicleid][vOwner],name, true ) == 0 )
        {
        format(str, sizeof(str), "You destroy %s's vehicle. %d insurance left", VehicleInfo[vehicleid][vOwner], insurance4);
        SendClientMessage(i, COLOR_LIGHTRED, str1);
        printf("Success2");
        }
     }
     if(dini_Int(str1, "Vehicle5") == vehicleid)
     {
        new ins = dini_Int(str1, "Ins5");
        insurance5 = ins-1;
        dini_IntSet(str1, "Ins5", insurance5);
        printf("Success");
        if(strcmp(VehicleInfo[vehicleid][vOwner],name, true ) == 0 )
        {
        format(str, sizeof(str), "You destroy %s's vehicle. %d insurance left", VehicleInfo[vehicleid][vOwner], insurance5);
        SendClientMessage(i, COLOR_LIGHTRED, str);
        printf("Success2");
        }
     }
  }
 }
}
I made a insurance system. The problems -
1. spam for me
pawn Код:
format(str, sizeof(str), "You destroy %s's vehicle. %d | %d", VehicleInfo[vehicleid][vOwner], dini_Int(str1, "Vehicle1"), vehicleid);
2. Write a Success message but change it to -99.
Thanks for any helper :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)