12.03.2019, 16:14
So, the problem is the /aveh create, or remove is just not working. If I type /aveh create I got back the sscanf line but if I fill the parameters nothing happens. Wheres the issue? Im confused.
PHP код:
CMD:aveh(playerid, params[]) {
new parameter[20];
if(pData[playerid][p_admin] < 5) return EmTag(playerid, YOU_HAVE_NO_PERMISSION);
if(sscanf(params, "s[20]", parameter)) return UsageTag(playerid, "/aveh [CREATE/REMOVE]");
if(!strcmp(parameter, "create", true)) {
new id = -1, mid, vcolor1, vcolor2;
new Float:x, Float:y, Float:z, Float:ang;
new string[128];
if(sscanf(params, "iii", mid, vcolor1, vcolor2)) return UsageTag(playerid, "/aveh create [MODEL] [COLOR1] [COLOR2]");
if(!(0 <= vcolor1 <= 255)) return EmTag(playerid, "The specified color1 is invalid (1-255)!");
if(!(0 <= vcolor2 <= 255)) return EmTag(playerid, "The specified color2 is invalid (1-255)!");
if(!(400 <= mid <= 611)) return EmTag(playerid, "The specified model ID is invalid (400-611)!");
GetPlayerPos(playerid, Float:x, Float:y, Float:z);
GetPlayerFacingAngle(playerid, Float:ang);
id = Vehicle_Create(0, mid, x, y, z, ang, vcolor1, vcolor2);
if(id == -1) return EmTag(playerid, "The server has reached the limit for dynamic vehicles.");
PutPlayerInVehicle(playerid, id, 0);
return 1;
}
if(!strcmp(parameter, "remove", true)) {
static id = 0;
if(sscanf(params, "d", id)) return UsageTag(playerid, "/aveh remove [ID]");
if(!IsValidVehicle(id) || Vehicle_GetID(id) == -1) return EmTag(playerid, "You have specified an invalid vehicle ID.");
if (IsPlayerInAnyVehicle(playerid))
id = GetPlayerVehicleID(playerid);
Vehicle_Delete(Vehicle_GetID(id));
return 1;
}
return 1;
}