IsValidSkin with admin command.
#1

Hello, when you buy a skin from the binco you get the new skins but when I try to do it with the admin command skins above ID 300 give me the message IsValidSkinID


Код:
CMD:setskin(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 3)
	{
		new string[128], giveplayerid, skinid;
		if(sscanf(params, "ud", giveplayerid, skinid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /setskin [player] [skinid]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(!IsInvalidSkin(skinid))
			{
				if(GetPlayerSkin(giveplayerid) == skinid)
				{
					SendClientMessageEx( playerid, COLOR_WHITE, "The person you're trying to change skins of already is using the skin you're trying to set." );
				}
				else
				{
					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][pModel]);
				}
			}
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "Invalid skin ID!");
			}
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
	}
	return 1;
}
I tough it is checking this stock if the skin is valid or not:

PHP код:
stock IsValidSkin(skinid)
{
    if (
skinid || skinid 311)
        return 
0;
    switch (
skinid)
    {
        case
        
010510610710210369123,
        
104114115116174175100247173,
        
248117118147163212414371,
        
156176177108109110165166,
        
265266267269270271274276,
        
277278279280281282283284,
        
285286287288294296297300301,
        
302303,304305310311: return 0;
    }
    return 
1;
}
stock IsFemaleSpawnSkin(skinid)
{
    switch (
skinid)
    {
        case
        
911121331383940415354,
        
5556657677899193129130,
        
131141148150151157169172190,
        
191192193194195196197198199,
        
211214215216218219224225226,
        
231232233263298306307308309: return 1;
    }
    return 
0;
}
stock IsFemaleSkin(skinid)
{
    switch (
skinid)
    {
        case
        
91112133138394041535455,
        
566364657576778587888990,
        
919293129130131138139140141,
        
145148150151152157169172178190,
        
191192193194195196197198199201,
        
205207211214215216218219224225,
        
226231232233237238243244245246,
        
251256257263298306307308309: return 1;
    }
    return 
0;

But after adding the new skins here it still gives me the message invalid skin
Reply
#2

Your functions names are different.

Change if(!IsInvalidSkin(skinid)) to if(IsValidSkin(skinid))

And remove skin id 300 to 311 from IsValidSkin function.
Reply
#3

Quote:
Originally Posted by Nubik
Посмотреть сообщение
Your functions names are different.

Change if(!IsInvalidSkin(skinid)) to if(IsValidSkin(skinid))

And remove skin id 300 to 311 from IsValidSkin function.
it did work for /setskin but now if I try to take a skin above ID 300 from the group locker it doesn't work here the dialog:

PHP код:
case G_LOCKER_UNIFORM: if(response)    {
            new 
skin strval(inputtext), iGroupID PlayerInfo[playerid][pMember];
            if(
IsInvalidSkin(skin)) {
                return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
            }
            
PlayerInfo[playerid][pModel] = skin;
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]); 
Reply
#4

Quote:
Originally Posted by SacrificeGaming
Посмотреть сообщение
it did work for /setskin but now if I try to take a skin above ID 300 from the group locker it doesn't work here the dialog:

PHP код:
case G_LOCKER_UNIFORM: if(response)    {
            new 
skin strval(inputtext), iGroupID PlayerInfo[playerid][pMember];
            if(
IsInvalidSkin(skin)) {
                return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
            }
            
PlayerInfo[playerid][pModel] = skin;
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]); 
There are probably two functions in your gamemode "IsValidSkin" and "IsInvalidSkin", notice you are now using IsValidSkin in /setskin command and IsInvalidSkin in dialog.

This will work.

PHP код:
case G_LOCKER_UNIFORM: if(response)    {
            new 
skin strval(inputtext), iGroupID PlayerInfo[playerid][pMember];
            if(
IsValidSkin(skin)) {
                return 
ShowPlayerDialog(playeridG_LOCKER_UNIFORMDIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName],"Invalid skin specified. Choose another.""Select""Cancel");
            }
            
PlayerInfo[playerid][pModel] = skin;
            
SetPlayerSkin(playeridPlayerInfo[playerid][pModel]); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)