SA-MP Forums Archive
Command /buyclothes problem , I GIVE REP !!! Help pls. - 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: Command /buyclothes problem , I GIVE REP !!! Help pls. (/showthread.php?tid=541091)



Command /buyclothes problem , I GIVE REP !!! Help pls. - buburuzu19 - 09.10.2014

My buyclothes command is :
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 id, skin;
            if(sscanf(params,"i",skin)) 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(skin)) return SendClientMessage(playerid,-1,"Please enter a valid skin id.");
            playerVariables[id][pSkin] = skin;
            SetPlayerSkin(id, skin);
            new wakaname[25];
            GetPlayerName(id,wakaname,25);
            new string233[28];
            format(string233,sizeof(string233),"You've bought skin id %d .",skin);
            SendClientMessage(playerid,-1,string233);
            playerVariables[playerid][pMoney] -= 1500;
            businessVariables[businessID][bVault] += 1500;
            }
        }
        return 1;
}
pawn Код:
stock IsValidSkin( skin )
{
    if(skin == 74 || skin > 299 || skin < 0 )
        return 0;

    return 1;
}
and i want that the players who are not in a faction to not buy police skins and civilians have separate skin ids. I want to give them a reply message , like You are not part of LSPD.


Re: Command /buyclothes problem , I GIVE REP !!! Help pls. - YanLanger - 09.10.2014

And the problem is ? warnings/errors

Or it ain't working properly


Re: Command /buyclothes problem , I GIVE REP !!! Help pls. - buburuzu19 - 09.10.2014

I want to make separate skins for separate groups.
Variables:
public SetPlayerToTeamColor(playerid)
{
if(IsPlayerConnected(playerid))
{
if(playerVariables[playerid][pGroup] == 0)
{
SetPlayerColor(playerid, COLOR_WHITE);
}
if(playerVariables[playerid][pGroup] == 1)
{
SetPlayerColor(playerid, COLOR_PD);
}
if(playerVariables[playerid][pGroup] == 2)
{
SetPlayerColor(playerid, COLOR_FBI);
}
if(playerVariables[playerid][pGroup] == 3)
{
SetPlayerColor(playerid,COLOR_NG);
}
if(playerVariables[playerid][pGroup] == 4)
{
SetPlayerColor(playerid,COLOR_MEDIC);
}
if(playerVariables[playerid][pGroup] == 5)
{
SetPlayerColor(playerid, COLOR_PD);
}
if(playerVariables[playerid][pGroup] == 6)
{
SetPlayerColor(playerid,COLOR_RussianMafia);
}
if(playerVariables[playerid][pGroup] == 7)
{
SetPlayerColor(playerid,COLOR_Grove);
}
if(playerVariables[playerid][pGroup] ==
{
SetPlayerColor(playerid,COLOR_Aztecas);
}
if(playerVariables[playerid][pGroup] == 9)
{
SetPlayerColor(playerid,COLOR_Riffa);
}
if(playerVariables[playerid][pGroup] == 10)
{
SetPlayerColor(playerid,COLOR_SFBikers);
}
if(playerVariables[playerid][pGroup] == 11)
{
SetPlayerColor(playerid,COLOR_Vagos);
}
if(playerVariables[playerid][pGroup] == 12)
{
SetPlayerColor(playerid,COLOR_HITMAN);
}
if(playerVariables[playerid][pGroup] == 13)
{
SetPlayerColor(playerid,COLOR_SI);
}
if(playerVariables[playerid][pGroup] == 14)
{
SetPlayerColor(playerid,COLOR_YELLOW);
}
if(playerVariables[playerid][pGroup] == 15)
{
SetPlayerColor(playerid,COLOR_NEWS);
}
}
}


Re: Command /buyclothes problem , I GIVE REP !!! Help pls. - DavidBilla - 09.10.2014

I don't understand what you are wanting, but using that many if statements could be replaced with switch statement.
pawn Код:
new group=playerVariables[playerid][pGroup];
switch(group)
{
    case 0:
    {
     //Your codes
    }
    case 1:
    {
    // Your codes
    }
    //Similarly other cases
}



Re: Command /buyclothes problem , I GIVE REP !!! Help pls. - buburuzu19 - 09.10.2014

If playerVariables[playerid][pGroup] == 0 , can't select LSPD skins wich is playerVariables[playerid][pGroup] == 1.
That's what i want to make.