19.09.2010, 09:07
Guys, this is absolutely possible, he just wants to show the name on enter, not change the number plate.
Create a big array like this:
new CarNames[MAX_VEHICLES][24];
Ok, this eats a lot of ram, ~200kb, but this should be no big problem.
Then add a command like this (untested):
Saving that all would be harder, because most ini includes do not support 2000 entries in a file. You would need a car saver system that creates a file for each car and spawns them from that file, so that there are no problems with changing vehicle ids.
Create a big array like this:
new CarNames[MAX_VEHICLES][24];
Ok, this eats a lot of ram, ~200kb, but this should be no big problem.
Then add a command like this (untested):
pawn Код:
//Usage: /setplate <new_name>
if(strcmp("/setplate", cmdtext, true, 9) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return 1;
strmid(CarNames[GetPlayerVehicleID(playerid)], cmdtext, 10, strlen(cmdtext));
new text[64];
format(text, 64, "You changed the vehicle's name to %s.", CarNames[GetPlayerVehicleID(playerid)]);
SendClientMessage(playerid, 0xAAAA33AA, text);
return 1;
}
//To show it on vehicle enter add this to your OnPlayerEnterVehicle, as you already mentioned
if(strlen(CarNames[vehicleid])
{
new text[64];
format(text, 64, "You entered the vehicle: %s.", CarNames[vehicleid]);
SendClientMessage(playerid, 0xAAAA33AA, text);
}
//Change all strings to whatever you want