pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[200], idx;
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/car", true))
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You don't put the vehicle name");
new vehicle = GetVehicleModelIDFromName(tmp);
if(!(400 <= vehicle <= 611)) return SendClientMessage(playerid, l_red, "That vehicle name was not found");
new Float:a, Float:x, Float:y, Float:z, String[45];
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, (IsPlayerInAnyVehicle(playerid)) ? (8) : (5));
new pveh = CreateVehicle(vehicle, x, y, z, a, -1, -1, 1);
LinkVehicleToInterior(pveh, GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, pveh, 0);
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, l_green, String);
return 1;
}
return 0;
}
You were doing:
pawn Код:
PutPlayerInVehicle(playerid, vehicle, 0);
You were supposed to do:
pawn Код:
PutPlayerInVehicle(playerid, PlayersVehicle, 0);