PDA

View Full Version : ID bug


PrinceOfPersia
20/05/2014, 10:08 AM
Hey guys, I've got ID bug.

It's
When you like /setskin [ID 0] [285] It doesn't even give ID 0 the skin, it wants to give the skin to id 1 instead of id 0, also, like there's no ID 1 online, so the script wont find any another one to give the skin to, so it wont give the skin, it's for the all commands also.

ThatThoseTheThy
20/05/2014, 10:28 AM
Show the script lines of the /setskin command

PrinceOfPersia
20/05/2014, 10:33 AM
CMD:setskin(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid, skinid;
if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");

if(IsPlayerConnected(giveplayerid))
{
if(!IsInvalidSkin(skinid))
{
if(GetPlayerSkin(giveplayerid) == skinid)
{
SendClientMessageEx( playerid, COLOR_WHITE, "The player you're trying to change skins of already is using the skin you're trying to set." );
}
else
{
PlayerInfo[giveplayerid][pChar] = skinid;
PlayerInfo[giveplayerid][pModel] = skinid;
format(string, sizeof(string), "Your skin has been changed to ID %d by Administrator %s.", skinid, GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have given %s skin ID %d.", GetPlayerNameEx(giveplayerid), skinid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pChar]);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

Konstantinos
20/05/2014, 10:35 AM
Is the sscanf updated to the latest version?

PrinceOfPersia
20/05/2014, 10:35 AM
No, It's not.

Konstantinos
20/05/2014, 10:37 AM
Then update both sscanf plugin and its include, re-compile and try again.

You should always use the latest version of any plugin/include!

Threshold
20/05/2014, 10:37 AM
If you're using sscanf, update it.

Otherwise, show us your code.

EDIT: I should really refresh the page before I submit...

PrinceOfPersia
20/05/2014, 10:38 AM
Thanks for the advice guys.

But, any problems if I've got the links of them ? thanks.

Konstantinos
20/05/2014, 10:39 AM
But next time search: http://forum.sa-mp.com/showthread.php?t=120356

PrinceOfPersia
20/05/2014, 10:44 AM
Fixed.
I hope this bug wont continue, if it continued please keep updated in this thread guys, thanks.

PrinceOfPersia
20/05/2014, 11:25 AM
The bug continues.

Matess
20/05/2014, 11:31 AM
Why are you using parameter "u" for nick/id if you aren't working with it? It shouldn't be problem, but try.

//Well if it's global problem, then error won't be here

if(sscanf(params, "dd", giveplayerid, skinid))


CMD:setskin(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid, skinid;
if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]"); // change "ud" for "dd"

if(IsPlayerConnected(giveplayerid))
{
if(!IsInvalidSkin(skinid))
{
if(GetPlayerSkin(giveplayerid) == skinid)
{
SendClientMessageEx( playerid, COLOR_WHITE, "The player you're trying to change skins of already is using the skin you're trying to set." );
}
else
{
PlayerInfo[giveplayerid][pChar] = skinid;
PlayerInfo[giveplayerid][pModel] = skinid;
format(string, sizeof(string), "Your skin has been changed to ID %d by Administrator %s.", skinid, GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have given %s skin ID %d.", GetPlayerNameEx(giveplayerid), skinid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pChar]);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

K9IsGodly
20/05/2014, 11:33 AM
Try this:


CMD:setskin(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid, skinid;
if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /setskin [playerid] [skinid]");
if(!IsPlayerConnected(giveplayerid))
return SendClientMessage(playerid, -1, "That player is offline!");
if(!IsInvalidSkin(skinid))
{
if(GetPlayerSkin(giveplayerid) == skinid)
{
SendClientMessageEx( playerid, COLOR_WHITE, "The player you're trying to change skins of already is using the skin you're trying to set." );
}
else
{
PlayerInfo[giveplayerid][pChar] = skinid;
PlayerInfo[giveplayerid][pModel] = skinid;
format(string, sizeof(string), "Your skin has been changed to ID %d by Administrator %s.", skinid, GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string), "You have given %s skin ID %d.", GetPlayerNameEx(giveplayerid), skinid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
SetPlayerSkin(giveplayerid, PlayerInfo[giveplayerid][pChar]);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!");
}

}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

Konstantinos
20/05/2014, 11:34 AM
Why are you using parameter "u" for nick/id if you aren't working with it? It shouldn't be problem, but try.


if(sscanf(params, "dd", giveplayerid, skinid))


Because he wants to use either part of player's name or player's ID and that's not possible with "d" specifier.

@PrinceOfPersia: Did you also recompile your scripts that use sscanf with the latest version of sscanf2.inc?

PrinceOfPersia
20/05/2014, 11:38 AM
Yes, I recompiled.
Also, it's not for CMD:setskin, it's for all admin cmds to give players anything.

PrinceOfPersia
20/05/2014, 12:17 PM
Any solution ?