03.10.2015, 11:07
actually you should size the arrays in sscanf
Try this
Try this
PHP код:
CMD:veh(playerid, params[])
{
new model[32], color1, color2, VehicleID, string[128];
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(sscanf(params, "s[32]ii", model, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /veh [ID/NAME] || Optional: [Color1] [Color2]");
VehicleID = GetVehicleModelIDFromName(model);
if(VehicleID == -1 )
{
VehicleID = strval(model);
if(VehicleID < 400 || VehicleID > 611 )
{
return SendClientMessage(playerid, COLOR_WHITE, "SERVER: You entered an invalid vehicle name or ID!");
}
}
if(IsPlayerInAnyVehicle(playerid))
{
new vehicle = GetPlayerVehicleID(playerid);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vehicle);
}
if(AdmVeh[playerid] != 0){
DestroyVehicle(AdmVeh[playerid]);}
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid,A);
new carid = CreateVehicle(VehicleID, X,Y,Z,A, color1, color2, -1);
PutPlayerInVehicle(playerid,carid, 0);
LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
format(string, sizeof(string), "{FFFFFF}SERVER: You've spawned the selected vehicle.");
SendClientMessage(playerid, COLOR_WHITE, string);
AdmVeh[playerid] = carid;
}
else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
return 1;
}