24.01.2015, 06:06
When the command is typed it says it is unknown.
*I dont get any errors and all other commands work*
*I dont get any errors and all other commands work*
pawn Код:
CMD:createcar(playerid, params[])
{
new Float: pos[4], name[MAX_PLAYER_NAME], model, type, price, plate = random(1000 + 2500), newveh[MAX_PLAYERS], string[30];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
if(sscanf(params, "iii", model, type, price)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /createcar [model] [type] [price]");
format(name, sizeof(name), "None"); // to avoid array error -- size is MAX_PLAYER_NAME, as is hOwner
new INI:File = INI_Open(VehiclePath(vCount));
INI_SetTag(File, "Vehicle Data");
INI_WriteString(File, "Owner", name);
vInfo[vCount][Owner] = name;
INI_WriteInt(File, "Model", model);
vInfo[vCount][Model] = model;
INI_WriteInt(File, "Type", type);
vInfo[vCount][Type] = type;
INI_WriteFloat(File, "xPos", pos[0]);
vInfo[vCount][xPos] = pos[0];
INI_WriteFloat(File, "yPos", pos[1]);
vInfo[vCount][yPos] = pos[1];
INI_WriteFloat(File, "zPos", pos[2]);
vInfo[vCount][zPos] = pos[2];
INI_WriteFloat(File, "aPos", pos[3]);
vInfo[vCount][aPos] = pos[3];
INI_WriteInt(File, "Price", price);
vInfo[vCount][Price] = price;
INI_WriteInt(File, "Plate", plate);
vInfo[vCount][Plate] = plate;
INI_WriteInt(File, "Fuel", 100);
vInfo[vCount][Fuel] = 100;
INI_WriteInt(File, "StoredSlot1", 0);
vInfo[vCount][StoredSlot1] = 0;
INI_WriteInt(File, "StoredSlot1Ammo", 0);
vInfo[vCount][StoredSlot1Ammo] = 0;
INI_WriteInt(File, "StoredSlot2", 0);
vInfo[vCount][StoredSlot2] = 0;
INI_WriteInt(File, "StoredSlot2Ammo", 0);
vInfo[vCount][StoredSlot2Ammo] = 0;
INI_Close(File);
format(string, sizeof(string), "SA %d", vInfo[vCount][Plate]);
newveh[playerid] = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], 0, 0, -1);
SetVehicleNumberPlate(newveh[playerid], string);
SetVehicleToRespawn(newveh[playerid]);
vCount ++;
PutPlayerInVehicle(playerid, newveh[playerid], 0);
SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You have created a vehicle at your position!");
return true;
}

