#1

I simply try to make a DMP Markertype with any ID. (via; 54 Gym Icon) All it does is repeat to ID 20 or 21. Here is the command and here is the result I get.

Quote:

CMD:dmpedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}

new string[128], choice[32], mapiconid, amount;
if(sscanf(params, "s[32]dD", choice, mapiconid, amount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /dmpedit [name] [mapiconid] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Position, MarkerType, Color, Delete");
return 1;
}

if(mapiconid < 0 || mapiconid >= MAX_DMAPICONS)
{
SendClientMessageEx( playerid, COLOR_WHITE, "Invalid Map Icon ID!");
}

if(strcmp(choice, "position", true) == 0)
{
GetPlayerPos(playerid, DMPInfo[mapiconid][dmpPosX], DMPInfo[mapiconid][dmpPosY], DMPInfo[mapiconid][dmpPosZ]);
DMPInfo[mapiconid][dmpInt] = GetPlayerInterior(playerid);
DMPInfo[mapiconid][dmpVW] = GetPlayerVirtualWorld(playerid);
SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the position!");
if(IsValidDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID])) DestroyDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID]);
DMPInfo[mapiconid][dmpMapIconID] = CreateDynamicMapIcon(DMPInfo[mapiconid][dmpPosX], DMPInfo[mapiconid][dmpPosY], DMPInfo[mapiconid][dmpPosZ], DMPInfo[mapiconid][dmpMarkerType], DMPInfo[mapiconid][dmpColor], DMPInfo[mapiconid][dmpVW], DMPInfo[mapiconid][dmpInt], -1, 500.0);
SaveDynamicMapIcons();
format(string, sizeof(string), "%s has edited MapIconID %d's Position.", GetPlayerNameEx(playerid), mapiconid);
Log("logs/dmpedit.log", string);
return 1;
}
else if(strcmp(choice, "delete", true) == 0)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You have deleted the map icon!");
DMPInfo[mapiconid][dmpPosX] = 0.0;
DMPInfo[mapiconid][dmpPosY] = 0.0;
DMPInfo[mapiconid][dmpPosZ] = 0.0;
DMPInfo[mapiconid][dmpVW] = 0;
DMPInfo[mapiconid][dmpInt] = 0;
DMPInfo[mapiconid][dmpMarkerType] = 0;
DMPInfo[mapiconid][dmpColor] = 0;
SaveDynamicMapIcons();
if(IsValidDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID])) DestroyDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID]);
format(string, sizeof(string), "%s has deleted MapIconID %d.", GetPlayerNameEx(playerid), mapiconid);
Log("logs/dmpedit.log", string);
return 1;

}
else if(strcmp(choice, "markertype", true) == 0)
{
DMPInfo[mapiconid][dmpMarkerType] = amount;
format(string, sizeof(string), "You have set the marker type to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(IsValidDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID])) DestroyDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID]);
DMPInfo[mapiconid][dmpMapIconID] = CreateDynamicMapIcon(DMPInfo[mapiconid][dmpPosX], DMPInfo[mapiconid][dmpPosY], DMPInfo[mapiconid][dmpPosZ], DMPInfo[mapiconid][dmpMarkerType], DMPInfo[mapiconid][dmpColor], DMPInfo[mapiconid][dmpVW], DMPInfo[mapiconid][dmpInt], -1, 500.0);
format(string, sizeof(string), "%s has edited MapIconID %d's Marker Type to %d.", GetPlayerNameEx(playerid), mapiconid, amount);
Log("logs/dmpedit.log", string);
}
else if(strcmp(choice, "color", true) == 0)
{
DMPInfo[mapiconid][dmpColor] = amount;
format(string, sizeof(string), "You have set the color to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
if(IsValidDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID])) DestroyDynamicMapIcon(DMPInfo[mapiconid][dmpMapIconID]);
DMPInfo[mapiconid][dmpMapIconID] = CreateDynamicMapIcon(DMPInfo[mapiconid][dmpPosX], DMPInfo[mapiconid][dmpPosY], DMPInfo[mapiconid][dmpPosZ], DMPInfo[mapiconid][dmpMarkerType], DMPInfo[mapiconid][dmpColor], DMPInfo[mapiconid][dmpVW], DMPInfo[mapiconid][dmpInt], -1, 500.0);
format(string, sizeof(string), "%s has edited MapIconID %d's Color to %d.", GetPlayerNameEx(playerid), mapiconid, amount);
Log("logs/dmpedit.log", string);
}
SaveDynamicMapIcons();
return 1;
}

Reply
#2

pawn Код:
if(sscanf(params, "s[32]dd", choice, mapiconid, amount))
Its case sensitive.
Reply
#3

Case sensitive meaning what? How would I fix it?
Reply
#4

Change

pawn Код:
if(sscanf(params, "s[32]dD", choice, mapiconid, amount))
to

pawn Код:
if(sscanf(params, "s[32]dd", choice, mapiconid, amount))
Reply
#5

http://puu.sh/6FNYp/3369a2847a.png

Your code is from NG:RP, I double checked.
Reply
#6

Quote:
Originally Posted by ACI
Посмотреть сообщение
Change

pawn Код:
if(sscanf(params, "s[32]dD", choice, mapiconid, amount))
to

pawn Код:
if(sscanf(params, "s[32]dd", choice, mapiconid, amount))
The capital D is for optional parameter in sscanf2. Removing it would make the command optional last parameter non optional.

If you're not using sscanf2 though it would not work... Try changing dD (decimal decimal) to iI (integer integer)
Reply
#7

I've encountered another problem with this. I tried changing the dD to dd, and I also tried iI. All both of these do is nothing, I type the command and it just shows the syntax:

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)