Clothes cmd request - i give rep
#1

Hey , all i want is a simple clothes cmd for my server because all that i have are bugged. A classic command /clothes that can be accesed inside binco.
I give rep,
Thanks.
Reply
#2

Here is a basic command.

pawn Код:
stock IsValidSkin( skinid )
{
    if( skinid == 74 || skinid > 299 || skinid < 0 )
        return 0;
       
    return 1;
}
CMD:buyclothes(playerid,params[])
{
     new skinid;
     if(sscanf(params,"i",skinid)) return SendClientMessage(playerid,-1,"SYNTAX: /buyclothes [skinid]");// gives a        message if the player hasn't entered a skinid
     if(!IsPlayerInRangeOfPoint(playerid, 7.0, 207.7145,-103.5601,1005.2578)) return     SendClientMessage(playerid,-1,"You are not at binco");// checks if the player is at binco, if not it returns in an error
     if(!IsValidSkin(skinid)) return SendClientMessage(playerid,-1,"Please enter a valid skin id");
     GivePlayerMoney(playerid,-500);//Set this according to your choice
     SetPlayerSkin(playerid,skinid)//Set's the player's skin id to the id he entered
     new string[28];// a string variable
     format(string,sizeof(string),"You've bought skin id %d",skinid);//formats the string
     SendClientMessage(playerid,-1,string);// Sends a confirmation message
     return 1;
}
I haven't tested this command

EDIT: Thanks Flake
Reply
#3

You should also make a check to make sure they're entering a valid skin id.

pawn Код:
stock IsValidSkin( skinid )
{
    if( skinid == 74 || skinid > 299 || skinid < 0 )
        return 0;
       
    return 1;
}
Credits to Lorenc_ for that pre-made one.
Reply
#4

Added that to the code, thanks flake
Reply
#5

So i have the command :
pawn Код:
CMD:buyclothes(playerid,params[])
{
    if(GetPlayerVirtualWorld(playerid)-BUSINESS_VIRTUAL_WORLD >= 1)
    {
        new businessID;
        businessID = GetPlayerVirtualWorld(playerid) - BUSINESS_VIRTUAL_WORLD;
        if(businessVariables[businessID][bType] == 2)
        {
             new skinid;
             new wakaname[25];
             if(sscanf(params,"i",skinid)) return SendClientMessage(playerid, COLOR_GREY,"SYNTAX: /buyclothes [skinid]");
             if(!IsPlayerInRangeOfPoint(playerid, 7.0, 207.7145,-103.5601,1005.2578)) return     SendClientMessage(playerid,-1,"You are not at binco");
             if(!IsValidSkin(skinid)) return SendClientMessage(playerid,-1,"Please enter a valid skin id");
             SetPlayerSkin(playerid, skinid);
             playerVariables[playerid][pMoney] -= 1500;
             businessVariables[businessID][bVault] += 1500;
             new string[28];
             format(string,sizeof(string),"You've bought skin id %d",skinid);
             SendClientMessage(playerid,-1,string);
             new str[128];
             format(str,128,"UPDATE `playeraccounts` SET `playerSkin`='%d' WHERE `playerName`='%s'",skinid,wakaname);
             mysql_query(str);
            }
        }
        return 1;
}
and the skin is changing when i buy it, but at respawn it doesen't.
My setskin command is:
pawn Код:
CMD:setskin(playerid,params[])
{
    if(playerVariables[playerid][pAdminLevel] >= 1)
    {
        new id, string[256], giveplayer[25],skin;
        if(sscanf(params, "ui", id,skin)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/setskin [playerid] [skin id]");
        {
            if(id != INVALID_PLAYER_ID)
            {
                if(skin < 300 && skin >= 0)
                {
                    GetPlayerName(id, giveplayer, sizeof(giveplayer));
                    format(string, sizeof(string), "You set %s's skin to %d.", giveplayer, skin);
                    SendClientMessage(playerid, COLOR_WHITE, string);
                    playerVariables[id][pSkin] = skin;
                    SetPlayerSkin(id, skin);
                    new wakaname[25];
                    GetPlayerName(id,wakaname,25);
                    new str[128];
                    format(str,128,"UPDATE `playeraccounts` SET `playerSkin`='%d' WHERE `playerName`='%s'",skin,wakaname);
                    mysql_query(str);
                }
            }
        }
    }
    else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
    return 1;
}
Reply
#6

Ok, you have the skin saved. Now put it to load under
pawn Код:
public OnPlayerSpawn(playerid)
{
    //Variables to the skins location in the database
    SetPlayerSkin(playerid, SKINVARIABLEGOESHERE);
    return 1;
}
might be loosely indented. I just wrote this.
Reply
#7

I have OnPlayerSpawn a variable who saves the skins , the sql structure that i posted up is wrong , i give rep ! Thx
Reply
#8

UPPPPPPPPP!
Reply
#9

UP !
The clothes aren't saving , format(str,128,"UPDATE `playeraccounts` SET `playerSkin`='%d' WHERE `playerName`='%s'",skin,wakaname); have no sense , i give rep please help!!!
Reply
#10

Use pawn codes first.

Second pay attention to what you're scripting.

pawn Код:
format(str,128,"UPDATE `playeraccounts' SET `playerSkin`='%d' WHERE `playerName`='%s'",skin,wakaname); // you've put ' not `
Third.

Show us what you've done. Whole code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)