GetVehiclePlate
#7

yees possible, only thing you need, a 1 new callback, and an variable for each car (array?) ,
for example:
pawn Код:
#define MAX_PLATE_STRINGLENGTH 11 //real value = 10

#define MAX_USED_CARS 700

new Getvehicleplate[MAX_USED_CARS][MAX_PLATE_STRINGLENGTH];

forward Setvehicleplate(carid, plate_string[10]);


public Setvehicleplate(carid, plate_string[10])
{
    Getvehicleplate[carid] = plate_string;
    SetVehicleNumberPlate(carid, plate_string);
    return carid;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx,cmd[256];
  cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/getcarplate", true) == 0)
    {
      new platestring[11];
      platestring = Getvehicleplate[GetPlayerVehicleID(playerid)];
      return 1;
    }
    return 0;
}

//strtok::
stock strtok(const string[], &index,seperator=' ')
{
    new length = strlen(string);
    new offset = index;
    new result[256];
    while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }

    result[index - offset] = EOS;
    if ((index < length) && (string[index] == seperator))
    {
        index++;
    }
    return result;
}
it should work, though i havent tested thus debugged it::
NOTE: a public cannot return a string, so if you want to use strings in plate names, this is the only fast way
Reply


Messages In This Thread
GetVehiclePlate - by Coicatak - 21.02.2009, 14:02
Re: GetVehiclePlate - by Sandra18[NL] - 21.02.2009, 14:02
Re: GetVehiclePlate - by CruncH - 21.02.2009, 15:16
Re: GetVehiclePlate - by Coicatak - 22.02.2009, 08:11
Re: GetVehiclePlate - by Danut - 22.02.2009, 08:12
Re: GetVehiclePlate - by Mikep - 22.02.2009, 08:46
Re: GetVehiclePlate - by maij - 22.02.2009, 08:51
Re: GetVehiclePlate - by boylett - 22.02.2009, 09:14
Re: GetVehiclePlate - by Finn - 22.02.2009, 09:18
Re: GetVehiclePlate - by Mikep - 22.02.2009, 11:20

Forum Jump:


Users browsing this thread: 2 Guest(s)