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;
}
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;
}
Whats the "unformat"? Sscanf function? If not, you cant use it along with sscanf as far as I know. Not in the same callback at least.
This forum requires that you wait 120 seconds between posts. Please try again in 56 seconds. |
I take a look at official sscanf thread about "Unformat" and then come back.
P.S, Why dont you just use if(sscanf(params, ... ![]() EDIT: I have took a look at sscanf thread. There is an "unformat" action indeed. I will take a look at ur script EDIT II: I am sorry but I do not see anything wrong here. Please wait for a higher leveled scripter to help ya out bro ![]() |
What is exactly what you're trying to do? as far as I understand it from this topic, you have a command that creates either MapIcons, vehicles, pickups or 3dtextlabels. If yes why did you create a seperate command to create an icon?
|