Need help with /payticket
#1

Heey guys
I made a payticket command but if the player pays his ticket how can i send that money to the cop who ticketed him?
Here is code:
Код:
dcmd_payticket(playerid,params[])
{
	#pragma unused params
	new string[128];
    if(IsSpawned[playerid] != 1)
	{
	    SendClientMessage(playerid,COLOR_RED,"You must be alive and spawned in order to be able to use this command.");
	    return 1;
	}
	if(IsKidnapped[playerid] == 1)
	{
	    SendClientMessage(playerid,COLOR_RED,"You are kidnapped. You cannot use this command.");
	    return 1;
	}
	if(HasTicket[playerid] != 1)
	{
	    SendClientMessage(playerid,COLOR_RED,"You do not have a ticket to pay.");
		return 1;
	}
	SendClientMessage(playerid,COLOR_DEADCONNECT,"[[_Ticket Paid_]]");
	SendClientMessage(playerid,COLOR_LIGHTBLUE,"You have paid your ticket of $2000 and your wanted level has been removed.");
	SetPlayerWantedLevel(playerid,0);
	GivePlayerMoney(playerid,-2000);

	HasTicket[playerid] =0;
	TimeToPayTicket[playerid] =0;

	format(string,sizeof(string),"[POLICE RADIO] Suspect %s(%d) has paid their ticket of $2000 and their wanted level has been removed.",PlayerName(playerid),playerid);
	SendClientMessageToAllCops(string);
	return 1;
}
Pls help
Thanks admigo
Reply
#2

You could just do /pay so when players get ticket Officer says to pay
pawn Код:
command(pay, playerid, params[])
{
    new id, plmoney, string[128];
    if(sscanf(params, "ud", id, plmoney))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /pay [playerid] [amount]");
    }
    else
    {
        if(Player[playerid][Money] >= plmoney)
        {
            if(IsPlayerConnectedEx(id) || id != playerid)
            {
                if(Spectator[id][SpecSpectatingPlayer] != -1)
                {
                    SendClientMessage(playerid, WHITE, "You're too far away.");
                }
                else
                {
                    if(plmoney > 0 && plmoney < 20000)
                    {
                        if(GetDistanceBetweenPlayers(playerid, id) < 5)
                        {
                            Player[playerid][Money] -= plmoney;
                            Player[id][Money] += plmoney;
                            format(string, sizeof(string), "You have paid $%s to %s.", IntToFormattedStr(plmoney), GetName(id));
                            SendClientMessage(playerid, WHITE, string);
                            format(string, sizeof(string), "* %s has paid %s some money ($%s).", GetName(playerid), GetName(id), IntToFormattedStr(plmoney));
                            NearByMessage(id, NICESKY, string);
                            new tmpip1[128], tmpip2[128];
                            GetPlayerIp(playerid, tmpip1, sizeof(tmpip1));
                            GetPlayerIp(id, tmpip2, sizeof(tmpip2));
                            new hour, minute, second, day, year, month;
                            gettime(hour, minute, second);
                            getdate(year, month, day);
                            format(string, sizeof(string), "[PAY] %s (IP: %s) has paid %s (IP: %s) $%s on %d/%d/%d (%d:%d:%d)", GetName(playerid), tmpip1, GetName(id), tmpip2, IntToFormattedStr(plmoney), day, month, year, hour, minute, second);
                            MoneyLog(string);
                            format(string, sizeof(string), "You have been paid $%s, by %s.", IntToFormattedStr(plmoney), GetName(playerid));
                            SendClientMessage(id, WHITE, string);
                           
                            if(Player[playerid][PlayingHours] == 0 && plmoney >= 999 && Player[playerid][AdminLevel] < 1)
                            {
                                format(string, sizeof(string), "WARNING: %s may possibly be money-farming, they've given $%s to %s (w/ 0 playing hours)", GetName(playerid), IntToFormattedStr(plmoney), GetName(id));
                                SendToAdmins(ADMINORANGE, string, 0);
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, WHITE, "You're too far away.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, WHITE, "You can't pay under $1, or over $19,999.");
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, WHITE, "Player not connected or not logged in, or is you.");
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)