SA-MP Forums Archive
DMP's - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: DMP's (/showthread.php?tid=491779)



DMP's - Ryan McDuff - 01.02.2014

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;
}




Re: DMP's - ACI - 01.02.2014

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


Re: DMP's - Ryan McDuff - 01.02.2014

Case sensitive meaning what? How would I fix it?


Re: DMP's - ACI - 01.02.2014

Change

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

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



Re: DMP's - Scaleta - 01.02.2014

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

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


Re: DMP's - CuervO - 01.02.2014

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)


Re: DMP's - Ryan McDuff - 01.02.2014

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: