[HELP] How to know if a player is gambling?
#1

Well, Hi.
I need to know if a player is gambling in the casino, for my money anticheat
No I don't want to disable the casino!
I just need to add his money PVar the money he won at the casino.
tried OnPlayerGable from uf.inc - didn't work for me, or I just didn't use it right?
how to use OnPlayerGamble?
Reply
#2

UP..
Reply
#3

Why not just check the interior ID of the player and see if their cash increases/decreases?
Reply
#4

Just put some variables if there's command or key.

Quote:

new PlayerGambling[MAX_PLAYERS];

and where player start's to gamble you have to put

Quote:

PlayerGambling[playerid] = 1;

where player stop with gambling you put

Quote:

if(PlayerGambling[playerid] < 1) return SendClientMessage(playerid, -1, "You aren't gambling");
PlayerGambling[playerid] = 0;

Command to check

Code:
CMD:pg(playerid,params[])
{
new string[64],pID,gtext[16];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1 ," You aren't RCON Admin ");
if(sscanf(params, "r",pID)) return SendClientMessage(playerid, -1, "Usage: /pg [playerid/Part of Name]");
if(PlayerGambling[playerid] == 1) { gtext = "gambling"; }
else if(PlayerGambling[playerid] == 0) { gtext = "not gambling"; }
format(string,sizeof(string),"%s is %s",GetName(pID),gtext);
SendClientMessage(playerid, -1, string);
return true;
}
Stock GetName is

Quote:

stock GetName(playerid) // thank you Gagi!
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
return pName;
}

And you have to reset variable under onplayerdisconnect
Reply
#5

Make an array of all locations of gambling machines, like I did with vending machines.

pawn Code:
forward IsPlayerNearVendingMachine(playerid);
stock IsPlayerNearVendingMachine(playerid)
{
    new Float:machines[][3] =
    {
        {-14.70,1175.36,18.95},
        {201.02,-107.62,0.90},
        {662.43,-552.16,15.71},
        {-76.03,1227.99,19.13},
        {1154.73,-1460.89,15.16},
        {1277.84,372.52,18.95},
        {1398.84,2222.61,10.42},
        {1520.15,1055.27,10.00},
        {1634.11,-2237.53,12.89},
        {1659.46,1722.86,10.22},
        {1729.79,-1943.05,12.95},
        {1789.21,-1369.27,15.16},
        {1928.73,-1772.45,12.95},
        {2060.12,-1897.64,12.93},
        {2085.77,2071.36,10.45},
        {2139.52,-1161.48,23.36},
        {2153.23,-1016.15,62.23},
        {2271.73,-76.46,25.96},
        {2319.99,2532.85,10.22},
        {2325.98,-1645.13,14.21},
        {2352.18,-1357.16,23.77},
        {2480.86,-1959.27,12.96},
        {2503.14,1243.70,10.22},
        {-253.74,2597.95,62.24},
        {-253.74,2599.76,62.24},
        {2647.70,1129.66,10.22},
        {2845.73,1295.05,10.79},
        {-862.83,1536.61,21.98},
        {-1350.12,492.29,10.59},
        {-1350.12,493.86,10.59},
        {-1455.12,2591.66,55.23},
        {-1980.79,142.66,27.07},
        {-2005.65,-490.05,34.73},
        {-2011.14,-398.34,34.73},
        {-2034.46,-490.05,34.73},
        {-2039.85,-398.34,34.73},
        {-2063.27,-490.05,34.73},
        {-2068.56,-398.34,34.73},
        {-2092.09,-490.05,34.73},
        {-2097.27,-398.34,34.73},
        {-2118.62,-422.41,34.73},
        {-2118.97,-423.65,34.73},
        {-2229.19,286.41,34.70},
        {-2420.18,985.95,44.30},
        {-2420.22,984.58,44.30},
        {2155.84,1607.88,1000.06},
        {2155.91,1606.77,1000.05},
        {2202.45,1617.01,1000.06},
        {2209.24,1621.21,1000.06},
        {2209.91,1607.20,1000.05},
        {2222.20,1606.77,1000.05},
        {2222.37,1602.64,1000.06},
        {2225.20,-1153.42,1025.91},
        {-15.10,-140.23,1003.63},
        {-16.12,-91.64,1003.63},
        {-16.53,-140.30,1003.63},
        {-17.55,-91.71,1003.63},
        {-19.04,-57.84,1003.63},
        {-32.45,-186.70,1003.63},
        {-33.88,-186.77,1003.63},
        {330.68,178.50,1020.07},
        {331.92,178.50,1020.07},
        {-35.73,-140.23,1003.63},
        {350.91,206.09,1008.48},
        {-36.15,-57.88,1003.63},
        {361.56,158.62,1008.48},
        {371.59,178.45,1020.07},
        {373.83,-178.14,1000.73},
        {374.89,188.98,1008.48},
        {379.04,-178.88,1000.73},
        {495.97,-24.32,1000.73},
        {500.56,-1.37,1000.73},
        {501.83,-1.43,1000.73},
        {2576.70,-1284.43,1061.09}
    };
    for(new i = 0; i < sizeof(machines); i++) if(IsPlayerInRangeOfPoint(playerid,2.0,machines[i][0],machines[i][1],machines[i][2])) return 1;
    return 0;
}
Then at OnPlayerKeyChange I have this, but I guess you should just flip a variable to 1 or 0.

pawn Code:
if(IsPlayerNearVendingMachine(playerid))
    {
            if(PlayerInfo[playerid][Cash] >= 10)
            {
                new Float:h;
                ApplyAnimation(playerid,"VENDING","VEND_Use",4.1,0,1,1,0,1,1);
                GetPlayerHealth(playerid, h);
                if(h < 80)
                {
                    SetPlayerHealth(playerid, h+20);
                }
                GivePlayerMinusCash(playerid, 10);
                if(PlayerInfo[playerid][Food] > 10)
                {
                    PlayerInfo[playerid][Food] = PlayerInfo[playerid][Food] - 10;
                }
                else if(PlayerInfo[playerid][Food] <= 10)
                {
                    PlayerInfo[playerid][Food] = 0;
                }
                new string2[64];
                format(string2,sizeof(string2), "Hunger: %d", PlayerInfo[playerid][Food]);
                TextDrawSetString(FoodText[playerid],string2);
            }
            else if(PlayerInfo[playerid][Cash] < 10)
            {
                SendClientMessage(playerid, COLOR_NEUTRALBLUE, "You  dont have enough money");
            }
            return 1;
    }
Reply
#6

but, what if a player is currently gambling BUT he uses money hack same time? if the variable equals 1 than he is at the casino but.. he can use cheats at this moment
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)