22.02.2009, 08:51
yees possible, only thing you need, a 1 new callback, and an variable for each car (array?) ,
for example:
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
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;
}
NOTE: a public cannot return a string, so if you want to use strings in plate names, this is the only fast way