#1

I've creating a ticket command & PAY But there a problem!! After A Cop ticket someone and he will Pay Before Example: he have " 45984 " After pay to the cop his money will be increased! More examples:

Ticket Price: 5000 after the player pay the ticket his money will be -5000 Why?

PHP код:
            GivePlayerCash(playerid, -fine);
            
GivePlayerCash(TicketIssuer[playerid], fine); 
Reply
#2

Why don't you you use GivePlayerMoney? Show us your GivePlayerCash function.
Reply
#3

Show us both, The full command and the function where you defined GivePlayerMoney?
Reply
#4

PHP код:
CMD:pay(playeridparams[])
{
    if(
HasBeenIssuedTicket{playerid} == true)
    {
        new 
fine random(10000) + 1000;
        if(
fine GetPlayerCash(playerid))
        {
            if( 
GetPlayerMoney(playerid)  <  fine) return SendClientMessage(playeridCOLOR_RED"{ff0000}ERROR : {ffffff}You don't have enough money to pay the ticket! RUN RUN !");
            
KillTimer(TicketTimer{playerid});
            
HasBeenIssuedTicket{playerid} = false;
            
format(fstrsizeof(fstr), "[DISPATCH]: Suspect %s [%d] has payed the ticket."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstr2sizeof(fstr2), "Ticket paid {33FF33}$%d{FFFFFF}. Innocent civilian status achieved."fine);
            
GameTextForPlayer(playerid"~G~TICKET PAID"50005);
            
SetPlayerColor(playeridCOLOR_WHITE);
            
SendClientMessage(playeridREDfstr2);
            
format(fstr2sizeof(fstr2), "The suspect has payed the ticket, you got paid $%d."fine);
            
GameTextForPlayer(TicketIssuer[playerid], "~B~TICKET PAYED"25005);
            
SendClientMessage(TicketIssuer[playerid], YELLOWfstr2);
            
GivePlayerCash(playerid, -fine);
            
GivePlayerCash(TicketIssuer[playerid], fine);
            
SetPlayerWantedLevel(playerid0);
            
SetPlayerScore(TicketIssuer[playerid], GetPlayerScore(TicketIssuer[playerid]) + 1);
            
SetPlayerScore(playeridGetPlayerScore(playerid) - 1);
            
PlayerInfo[TicketIssuer[playerid]][aTickets] ++;
            
PlayerInfo[playerid][aFined] ++;
            
TicketIssuer[playerid] = -1;
        }
        else
        {
            
SendClientMessage(playeridRED"{FF0000}[ERROR]: {ffffff}You dont have engouh money to pay.");
        }
    }
    else
    {
        
SendClientMessage(playeridRED"You have not been issued a ticket.");
    }
    return 
true;

Reply
#5

//whole anticheat you need, you dont even have to change hud money amount, because that can be modified player side.
new Money[MAX_PLAYERS];
#define GivePlayerCash(%0,%1) Money[%0]+=%1;
Reply
#6

PHP код:
CMD:pay(playeridparams[])
{
    if(
HasBeenIssuedTicket{playerid} == true)
    {
        new 
fine random(10000) + 1000;
        if(
fine GetPlayerCash(playerid))
        {
            if( 
GetPlayerMoney(playerid)  <  fine) return SendClientMessage(playeridCOLOR_RED"{ff0000}ERROR : {ffffff}You don't have enough money to pay the ticket! RUN RUN !");
            
KillTimer(TicketTimer{playerid});
            
HasBeenIssuedTicket{playerid} = false;
            
format(fstrsizeof(fstr), "[DISPATCH]: Suspect %s [%d] has payed the ticket."GetName(playerid), playerid);
            
CopRadio(BLUEfstr);
            
format(fstr2sizeof(fstr2), "Ticket paid {33FF33}$%d{FFFFFF}. Innocent civilian status achieved."fine);
            
GameTextForPlayer(playerid"~G~TICKET PAID"50005);
            
SetPlayerColor(playeridCOLOR_WHITE);
            
SendClientMessage(playeridREDfstr2);
            
format(fstr2sizeof(fstr2), "The suspect has payed the ticket, you got paid $%d."fine);
            
GameTextForPlayer(TicketIssuer[playerid], "~B~TICKET PAYED"25005);
            
SendClientMessage(TicketIssuer[playerid], YELLOWfstr2);
            
GivePlayerMoney(playerid, -fine);
            
GivePlayerMoney(TicketIssuer[playerid], fine);
            
SetPlayerWantedLevel(playerid0);
            
SetPlayerScore(TicketIssuer[playerid], GetPlayerScore(TicketIssuer[playerid]) + 1);
            
SetPlayerScore(playeridGetPlayerScore(playerid) - 1);
            
PlayerInfo[TicketIssuer[playerid]][aTickets] ++;
            
PlayerInfo[playerid][aFined] ++;
            
TicketIssuer[playerid] = -1;
        }
        else
        {
            
SendClientMessage(playeridRED"{FF0000}[ERROR]: {ffffff}You dont have engouh money to pay.");
        }
    }
    else
    {
        
SendClientMessage(playeridRED"You have not been issued a ticket.");
    }
    return 
true;

It will work I guess
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)