15.04.2011, 05:43
//Edit: Fixed the old problem -- Onto a new one..
Why isn't this working? The parameters work correctly, and as a seperate command, the icon gets added to the file - but it doesn't seem to be working all-together for some reason.
Command that works:
Why isn't this working? The parameters work correctly, and as a seperate command, the icon gets added to the file - but it doesn't seem to be working all-together for some reason.
pawn Код:
COMMAND:add(playerid, params[])
{
new
parameters[35],
mapicon_id,
mapicon_color,
Float:MapIconX,
Float:MapIconY,
Float:MapIconZ,
vModel,
Float:VX,
Float:VY,
Float:VZ,
Float:VA,
vColor1,
vColor2;
if(sscanf(params, "s[35]", parameters)) {
SendClientMessage(playerid, c_white, "[USAGE] /Add [Parameters]");
SendClientMessage(playerid, c_orange, "[PARAMETERS] MapIcon, Vehicle, Pickup, 3DTextLabel");
return 1;
}
if(strcmp(parameters, "MapIcon", true) == 0) { //Created by [L3th4l]
new MType, Float:MX, Float:MY, Float:MZ, MColor;
if(unformat(params, "ih", MType, MColor)) return SendClientMessage(playerid, c_white,"[USAGE] /AddIcon <Icon ID> <Icon Color>");
GetPlayerPos(playerid, MX, MY, MZ);
AddMapIconToFile(ICON_FILE_NAME, MX, MY, MZ, MType, MColor);
for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
{
CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, 100.0);
}
/*if(sscanf(params, "ih", mapicon_id, mapicon_color)) {
SendClientMessage(playerid, c_white, "[USAGE] /Add MapIcon [Icon ID] [Icon Colour]");
SendClientMessage(playerid, c_orange, "[FUNCTION] Creates a permanent Map Icon viewable by all players at your position.");
return 1;
}
GetPlayerPos(playerid, MapIconX, MapIconY, MapIconZ);
AddMapIconToFile(ICON_FILE_NAME, MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color);
for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
{
CreateDynamicMapIcon(MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color, -1, -1, -1, 100.0);
}*/
printf("[+] Pickup created at %f, %f, %f | ID: %d | Color: %h", MapIconX, MapIconY, MapIconZ, mapicon_id, mapicon_color);
return 1;
}
else if(strcmp(parameters, "Vehicle", true) == 0) {
if(IsPlayerInAnyVehicle(playerid)) {
GetPlayerPos(playerid, VX, VY, VZ);
GetVehicleZAngle(GetPlayerVehicleID(playerid), VA);
vModel = GetVehicleModel(GetPlayerVehicleID(playerid));
GetVehicleColor(GetPlayerVehicleID(playerid), vColor1, vColor2);
AddVehicleToFile(VEHICLE_FILE_NAME, VX, VY, VZ, VA, vModel, vColor1, vColor2);
printf("[+] Vehicle created at %f, %f, %f | Model: %d | Color1: %d, Color2: %d", VX, VY, VZ, vColor1, vColor2);
return 1;
}
}
return 1;
}
pawn Код:
CMD:addicon(playerid, params[])
{
new MType, Float:MX, Float:MY, Float:MZ, MColor;
if(unformat(params, "ih", MType, MColor)) return SendClientMessage(playerid, c_white,"[USAGE] /AddIcon <Icon ID> <Icon Color>");
GetPlayerPos(playerid, MX, MY, MZ);
AddMapIconToFile(ICON_FILE_NAME, MX, MY, MZ, MType, MColor);
for(new PID; PID < MAX_PLAYERS; PID++) if(IsPlayerConnected(PID))
{
CreateDynamicMapIcon(MX, MY, MZ, MType, MColor, -1, -1, -1, 100.0);
}
return 1;
}