dcmd command :)
#1

Hey guys

I am using this command for a house system:
pawn Код:
dcmd_house(playerid, params[])
{
    new text[48]; new novac;// novac = money
    if(sscanf(params, "s[48]i",text , novac))
    {
        SendClientMessage(playerid, WHITE, "HELP: /house info [ ] | lock [ ] | takemoney [value] | putmoney [value]");
        return 1;
    }
    if(strcmp(text,"info",true) == 0) // apartment info.
    {
        for(new i = 0; i < sizeof(ApartmentInfo); i++)
        {
            new string[500];
            if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
            {
                SendClientMessage(playerid, YELLOW, "|========================================|");
                if(ApartmentInfo[i][sLocked] == 1)
                {
                    SendClientMessage(playerid, WHITE, "Locked: Yes");
                }
                if(ApartmentInfo[i][sLocked] == 0)
                {
                    SendClientMessage(playerid, WHITE, "Locked: No");
                }
                format(string, sizeof(string), "Money in safe: %d $", ApartmentInfo[i][sMoney]);
                SendClientMessage(playerid, WHITE, string);
                format(string, sizeof(string), "House Price: %d $", ApartmentInfo[i][sPrice]);
                SendClientMessage(playerid, WHITE, string);
                SendClientMessage(playerid, YELLOW, "|========================================|");
                return 1;
            }
        }
        return 1;
    }
    if(strcmp(text,"lock",true) == 0) // lock/unlock apartment
    {
        for(new i = 0; i < sizeof(ApartmentInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 3,ApartmentInfo[i][sEnterx], ApartmentInfo[i][sEntery], ApartmentInfo[i][sEnterz]) && InApartment[playerid] == 501)
            {
                GetPlayerName(playerid, plname, sizeof(plname));
                if(strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
                {
                    if(ApartmentInfo[i][sLocked] == 1)
                    {
                        GameTextForPlayer(playerid, "~g~Unlocked", 5000, 6);
                        ApartmentInfo[i][sLocked] = 0;
                        return 1;
                    }
                    if(ApartmentInfo[i][sLocked] == 0)
                    {
                        GameTextForPlayer(playerid, "~r~Locked", 5000, 6);
                        ApartmentInfo[i][sLocked] = 1;
                        return 1;
                    }
                }
            }
            if(IsPlayerInRangeOfPoint(playerid, 25,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]))
            {
                if(IsPlayerInRangeOfPoint(playerid, 3,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && InApartment[playerid] != 501)
                {
                    GetPlayerName(playerid, plname, sizeof(plname));
                    if(strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0)
                    {
                        if(ApartmentInfo[i][sLocked] == 1)
                        {
                            GameTextForPlayer(playerid, "~g~Unlocked", 5000, 6);
                            ApartmentInfo[i][sLocked] = 0;
                            return 1;
                        }
                        if(ApartmentInfo[i][sLocked] == 0)
                        {
                            GameTextForPlayer(playerid, "~r~Locked", 5000, 6);
                            ApartmentInfo[i][sLocked] = 1;
                            return 1;
                        }
                    }
                }
                else { SendClientMessage(playerid, WHITE,"You are not in front of doors."); return 1; }
            }
        }
        return 1;
    }
    if(strcmp(text,"putmoney",true) == 0) // taking money from safe
    {
        new string[128];
        if(novac < 0) { return 1; }
        for(new i = 0; i < sizeof(ApartmentInfo); i++)
        {
            GetPlayerName(playerid, plname, sizeof(plname));
            if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0 && GetPlayerVirtualWorld(playerid) == ApartmentInfo[i][sWorld])
            {
                if(GetPlayerMoney(playerid) >= novac)
                {
                    ApartmentInfo[i][sMoney] += novac;
                    GivePlayerMoney(playerid,-novac);
                    format(string, sizeof(string), "You have put %d $ in safe, now you have: %d", novac, ApartmentInfo[i][sMoney]);
                    SendClientMessage(playerid, YELLOW, string);
                    SaveApartment(i);
                    return 1;
                }
                else { SendClientMessage(playerid,GREY,"You don't have enoguht money!"); return 1; }
            }
        }
        return 1;
    }
    if(strcmp(text,"takemoney",true) == 0) // puting money in safe
    {
        new string[128];
        if(novac < 0) { return 1; }
        for(new i = 0; i < sizeof(ApartmentInfo); i++)
        {
            GetPlayerName(playerid, plname, sizeof(plname));
            if(IsPlayerInRangeOfPoint(playerid, 10,ApartmentInfo[i][sExitx], ApartmentInfo[i][sExity], ApartmentInfo[i][sExitz]) && strcmp(ApartmentInfo[i][sOwner], plname, false ) == 0 && GetPlayerVirtualWorld(playerid) == ApartmentInfo[i][sWorld])
            {
                if(ApartmentInfo[i][sMoney] >= novac)
                {
                    ApartmentInfo[i][sMoney] -= novac;
                    GivePlayerMoney(playerid,novac);
                    format(string, sizeof(string), "You have take %d $ from safe, now you have: %d $", novac, ApartmentInfo[i][sMoney]);
                    SendClientMessage(playerid, YELLOW, string);
                    SaveApartment(i);
                    return 1;
                }
                else { SendClientMessage(playerid,GREY,"You don't have enoguht money!"); return 1; }
            }
        }
        return 1;
    }
    return 1;
}
The problem is when I type the "/house info" or "/house lock" it shows me what is the right form to write the command: (HELP: /house info [ ] | lock [ ] | takemoney [value] | putmoney [value])

Can someone help me plz ?
Reply


Messages In This Thread
dcmd command :) - by kubeba59 - 11.01.2014, 17:04
Re: dcmd command :) - by dominik523 - 11.01.2014, 17:22
Re: dcmd command :) - by kubeba59 - 11.01.2014, 17:32
Re: dcmd command :) - by ViciousRoleplay123 - 11.01.2014, 17:39
Re: dcmd command :) - by kubeba59 - 11.01.2014, 17:45
Re: dcmd command :) - by kubeba59 - 12.01.2014, 08:01
Re: dcmd command :) - by kubeba59 - 13.01.2014, 17:28
Re: dcmd command :) - by ConnorHunter - 13.01.2014, 18:13
Re: dcmd command :) - by kubeba59 - 16.01.2014, 06:03
Re: dcmd command :) - by Threshold - 16.01.2014, 07:28

Forum Jump:


Users browsing this thread: 1 Guest(s)