[Include] Cash Register System in SA-MP By OTACON
#1

[] Cash Register System in SA-MP By OTACON
'BETA'

[] Video:
[ame]www.youtube.com/watch?v=5-eVRHyB8hQ[/ame]

[] Information:
N/A

[] Function:
pawn Код:
native CreateCashRegister(_slot, Float:_posX, Float:_posY, Float:_posZ, Float:_posrX, Float:_posrY, Float:_posrZ); //to create the cash register.
native DestroyCashRegister(_slot); //to destroy the cash register.
native IsPlayerInRangeOfCashRegister(playerid, Float:_distance); //to check if the player is near a cash register.
native UpdateCashRegister(_slot); //to update the data of money from a cash register.
native GiveMoneyFromCashRegister(playerid, _cant); //to withdraw a specific amount of money from the cash register.
native PutMoneyInCashRegister(playerid, _cant); //to place a specific amount of money from the cash register, restбndosela the player.
native CountCashRegister(); //account all registers that are created.
native DestroyCashRegisterAll(); //destroys all registers created.
native GetMoneyInCashRegister(playerid); //checks if the corresponding box is money.
[] Example Usage:
pawn Код:
#include <a_samp>
    #include <zcmd>
    #include <a_CashRegister>

    public OnFilterScriptInit() {
        print("\n**************************************");
        print("     Cash Register System in SA-MP      ");
        print("           Date: 23/07/2013             ");
        print("            Author: OTACON              ");
        print("     --* Loaded with Success!!. *--     ");
        print("***************************************\n");

        CreateCashRegister(0, -2674.64355, 267.79822, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(1, -2677.96436, 267.79922, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(2, -2681.52490, 267.79755, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(3, -2671.36157, 267.61661, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(4, -2684.68579, 267.89069, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(5, -2688.02539, 268.00455, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(6, -2691.34619, 267.99829, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(7, -2694.72437, 268.12247, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(8, -2668.12427, 267.47256, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(9, -2664.72852, 267.28238, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(10, -2661.40698, 267.19272, 3.32653,   0.00000, 0.00000, 0.00000);
        CreateCashRegister(11, -2658.32715, 267.10367, 3.32653,   0.00000, 0.00000, 0.00000);
        return true;
    }
    public OnFilterScriptExit() {
        print("\n**************************************");
        print("     Cash Register System in SA-MP      ");
        print("           Date: 23/07/2013             ");
        print("            Author: OTACON              ");
        print("   --* Downloaded with Success!!. *--   ");
        print("***************************************\n");

        DestroyCashRegister(0);
        DestroyCashRegister(1);
        DestroyCashRegister(2);
        DestroyCashRegister(3);
        DestroyCashRegister(4);
        DestroyCashRegister(5);
        DestroyCashRegister(6);
        DestroyCashRegister(7);
        DestroyCashRegister(8);
        DestroyCashRegister(9);
        DestroyCashRegister(10);
        return true;
    }
    COMMAND:test1(playerid, params[]) {
        if(!IsPlayerInRangeOfCashRegister(playerid, 2.0)) return SendClientMessage(playerid,-1,"you not located near a cash register.");
        if(GetPlayerMoney(playerid)<=0) return SendClientMessage(playerid,-1,"you have no cash.");
        PutMoneyInCashRegister(playerid, 5000);
        SendClientMessage(playerid,-1,"You put $ 5000 in the register");
        return true;
    }
    COMMAND:test2(playerid, params[]) {
        if(!IsPlayerInRangeOfCashRegister(playerid, 2.0)) return SendClientMessage(playerid,-1,"you not located near a cash register.");
        if(GetMoneyInCashRegister(playerid)<=0) return SendClientMessage(playerid,-1,"This cash register has no more money.");
        GiveMoneyFromCashRegister(playerid, 100);
        SendClientMessage(playerid,-1,"You took 100 USD of the cash register");
        return true;
    }
    COMMAND:test3(playerid, params[]) {
        new _info[100];
        format(_info,sizeof(_info),"There are %d xajas registers created.",CountCashRegister());
        SendClientMessage(playerid,-1,_info);
        return true;
    }
    COMMAND:test4(playerid, params[]) {
        DestroyCashRegisterAll();
        SendClientMessage(playerid,-1,You have destroyed all registers created");
        return true;
    }
[] Downloads:

[] solidfiles:


[] password:
Otacon

[] Credits:
OTACON
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
Really? You have to pass an ID to the CREATE function? What happens if you get two the same? Have you not learned from map icons and dialogs that that is a bad design?
Not everyone can do everything how you want them too. Stop jumping down peoples throats.
Reply
#3

native PutMoneyInCashRegister(playerid, _cant); - really should be native PutMoneyInCashRegister(playerid,cashrid _cant); and it takes the money from the player and puts it in the reg you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)