10.04.2013, 10:17
(
Last edited by Dystans; 10/04/2013 at 10:51 AM.
)
Iggy1, your code don't work.
Gamer_Z, thanks, but what I have to do when I want to type "/car inf" and this command spawn the Infernus in the same way as "/car 411" and "/car Infernus"? More specifically, I want to check only part of whole name.
@edit: I don't know what I'm doing bad, but errm... your code didn't work too. I'm create map, as you told me, but when I try to execute this command in OnPlayerCommandText:
nothing spawns.
Gamer_Z, thanks, but what I have to do when I want to type "/car inf" and this command spawn the Infernus in the same way as "/car 411" and "/car Infernus"? More specifically, I want to check only part of whole name.
@edit: I don't know what I'm doing bad, but errm... your code didn't work too. I'm create map, as you told me, but when I try to execute this command in OnPlayerCommandText:
pawn Code:
else if(strcmp(cmd, "/car") == 0)
{
int carid;
char
string[148],
*cmd;
cmd = strtok(const_cast<char*>(cmdtext), " ");
#define strtok_special(a,b) cmd = strtok(NULL, " "); if(cmd == 0 || !strlen(cmd)) return a; b = strval(cmd);
strtok_special(SendClientMessage(playerid, COLOR_WHITE, "/car [id / name]"), carid);
if(!strlen(cmd)) return SendClientMessage(playerid, COLOR_ADMIN, "Where is your car name?");
carid = GetVehicleModelIDFromName(cmd);
//if(carid < 400 || carid > 611) return SendClientMessage(playerid, COLOR_ADMIN, "That vehicle name was not found"); // I suggested this code, but it nothing happens even it is commented. I've only message below, but without car name and ID...
sprintf(string, "Car: %s, ID: %d", aVehicleNames[carid - MIN_VEHI_ID], carid);
SendClientMessage(playerid, COLOR_GREEN, string);
CreatePlayerVehicle(playerid, carid);
return true;
}