Fine pay
#1

When a cop types /fine and the wanted player have to /pay how can i make it like that, but it's in dialog...
Код:
CMD:fine(playerid, params[])
{
    if(Team[playerid] <= 6)
    {
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
            {
                if(GetPlayerWantedLevel(player1) <= 1)
                {
                        if(!IsPlayerInAnyVehicle(player1))
                        {
                            if (GetDistanceBetweenPlayers(playerid, player1) < 10)
                            {
                                GetPlayerName(player1, playername, sizeof(playername));
                                GetPlayerName(playerid, adminname, sizeof(adminname));
                                format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
                                ShowPlayerDialog(player1, DIALOG_TICKET, DIALOG_STYLE_MSGBOX, string, "You can choose to pay or NOT to pay the ticket: \n•If you choose to pay (Costs $300), your wanted level \nwill decrease to zero. \n•If you choose NOT to pay, your wanted level \nwill increase to 2 stars.", "Pay", "Don't pay");
                                format(string, sizeof(string), "Officer %s has given %s a ticket", adminname, playername);
                                //Copstats[playerid][Tickets]++;
                                return SendClientMessageToAll(-1, string);
                            }
                            else return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
                        }
                        else return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
                }
                else return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            }
            else return SendClientMessage(playerid, -1, "ERROR: Player not found");
    }
    else return SendClientMessage(playerid, -1, "ERROR: You have to be a Cop to use this command");
}
Код:
CMD:pay(playerid, params[])
{
   	new String[250];
   	format(String,sizeof(String),"You have paided your fines!", PlayerInfo[playerid][Fines]);
	SendClientMessage(playerid,-1,String);
    PlayerInfo[playerid][Fines] = 0;
    SetPlayerWantedLevel(playerid, 0);
	GivePlayerMoney(playerid, -PlayerInfo[playerid][Fines]);
    TextDrawHideForPlayer(playerid, Fine[playerid]);
	PlayerWanted(playerid);
    return 1;
}
Reply
#2

You have paided your fines
Reply
#3

Any way how to do this.
When you typing /pay it need to say You cannot pay your ticket, The cop need you ask you first then you /pay
Reply
#4

Quote:
Originally Posted by Ryan50
Посмотреть сообщение
Any way how to do this.
When you typing /pay it need to say You cannot pay your ticket, The cop need you ask you first then you /pay
I didn't understand what you want, if the player doesn't have a fine active it will say that you can't pay?
Reply
#5

It's something like this


Код:
new PlayerFineAsk[MAX_PLAYERS];
Код:
CMD:fine(playerid, params[])
{
    if(Team[playerid] <= 6)
    {
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
            {
                if(GetPlayerWantedLevel(player1) <= 1)
                {
                        if(!IsPlayerInAnyVehicle(player1))
                        {
                            if (GetDistanceBetweenPlayers(playerid, player1) < 10)
                            {
                                GetPlayerName(player1, playername, sizeof(playername));
                                GetPlayerName(playerid, adminname, sizeof(adminname));
                                format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
                                format(string, sizeof(string), "Officer %s has given %s a ticket", adminname, playername);
                                PlayerFineAsk[player1] = 1;
                                //Copstats[playerid][Tickets]++;
                                return SendClientMessageToAll(-1, string);
                            }
                            else return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
                        }
                        else return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
                }
                else return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            }
            else return SendClientMessage(playerid, -1, "ERROR: Player not found");
    }
    else return SendClientMessage(playerid, -1, "ERROR: You have to be a Cop to use this command");
}
Код:
CMD:pay(playerid, params[])
{
    if(PlayerFineAsk(playerid) <= 1) return SendClientMessage(playerid,-1,"Any officer didn't issued you");
	{
        new String[250];
   	    format(String,sizeof(String),"You have paided your fines!", PlayerInfo[playerid][Fines]);
	    SendClientMessage(playerid,-1,String);
        PlayerInfo[playerid][Fines] = 0;
        SetPlayerWantedLevel(playerid, 0);
     	GivePlayerMoney(playerid, -PlayerInfo[playerid][Fines]);
        TextDrawHideForPlayer(playerid, Fine[playerid]);
    	PlayerWanted(playerid);
    	PlayerFineAsk[player1] = 0;
	}
    return 1;
}
But i got errors on this line.

Код:
(3628) : error 012: invalid function call, not a valid address
(3628) : warning 215: expression has no effect
(3628) : error 001: expected token: ";", but found ")"
(3628) : error 029: invalid expression, assumed zero
(3628) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
3628 Line:
Код:
if(PlayerFineAsk(playerid) <= 1) return SendClientMessage(playerid,-1,"Any officer didn't issued you");
Reply
#6

Maybe you want like this?

pawn Код:
CMD:fine(playerid, params[])
{
    new string2[256];
    if(Team[playerid] <= 6)
    {
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
            {
                if(GetPlayerWantedLevel(player1) <= 1)
                {
                        if(!IsPlayerInAnyVehicle(player1))
                        {
                            if (GetDistanceBetweenPlayers(playerid, player1) < 10)
                            {
                                GetPlayerName(player1, playername, sizeof(playername));
                                GetPlayerName(playerid, adminname, sizeof(adminname));
                                format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
                                SendClientMessage(player1, -1, string);
                                SetPVarInt(player1, "Fine", 1);
                                SetPVarInt(player1, "Issuerid", playerid);
                                format(string2, sizeof(string2), "Officer %s has given %s a ticket", adminname, playername);
                                //Copstats[playerid][Tickets]++;
                                return SendClientMessageToAll(-1, string2);
                            }
                            else return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
                        }
                        else return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
                }
                else return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            }
            else return SendClientMessage(playerid, -1, "ERROR: Player not found");
    }
    else return SendClientMessage(playerid, -1, "ERROR: You have to be a Cop to use this command");
}

CMD:pay(playerid, params[])
{
    new String[250], targetid;
    if (GetPVarInt(playerid, "Fine") != 1) return SendClientMessage(playerid, -1, "None issue a fine on you!");
    targetid = GetPVarInt(playerid, "Issuerid");
    format(String,sizeof(String),"You have paided your fines!", PlayerInfo[playerid][Fines]);
    SendClientMessage(playerid,-1,String);
    PlayerInfo[playerid][Fines] = 0;
    SetPlayerWantedLevel(playerid, 0);
    GivePlayerMoney(playerid, -PlayerInfo[playerid][Fines]);
    GivePlayerMoney(targetid, PlayerInfo[playerid][Fines]);
    TextDrawHideForPlayer(playerid, Fine[playerid]);
    PlayerWanted(playerid);
    return 1;
}
Reply
#7

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Maybe you want like this?

pawn Код:
CMD:fine(playerid, params[])
{
    new string2[256];
    if(Team[playerid] <= 6)
    {
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
            {
                if(GetPlayerWantedLevel(player1) <= 1)
                {
                        if(!IsPlayerInAnyVehicle(player1))
                        {
                            if (GetDistanceBetweenPlayers(playerid, player1) < 10)
                            {
                                GetPlayerName(player1, playername, sizeof(playername));
                                GetPlayerName(playerid, adminname, sizeof(adminname));
                                format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
                                SendClientMessage(player1, -1, string);
                                SetPVarInt(player1, "Fine", 1);
                                SetPVarInt(player1, "Issuerid", playerid);
                                format(string2, sizeof(string2), "Officer %s has given %s a ticket", adminname, playername);
                                //Copstats[playerid][Tickets]++;
                                return SendClientMessageToAll(-1, string2);
                            }
                            else return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
                        }
                        else return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
                }
                else return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            }
            else return SendClientMessage(playerid, -1, "ERROR: Player not found");
    }
    else return SendClientMessage(playerid, -1, "ERROR: You have to be a Cop to use this command");
}

CMD:pay(playerid, params[])
{
    new String[250], targetid;
    if (GetPVarInt(playerid, "Fine") != 1) return SendClientMessage(playerid, -1, "None issue a fine on you!");
    targetid = GetPVarInt(playerid, "Issuerid");
    format(String,sizeof(String),"You have paided your fines!", PlayerInfo[playerid][Fines]);
    SendClientMessage(playerid,-1,String);
    PlayerInfo[playerid][Fines] = 0;
    SetPlayerWantedLevel(playerid, 0);
    GivePlayerMoney(playerid, -PlayerInfo[playerid][Fines]);
    GivePlayerMoney(targetid, PlayerInfo[playerid][Fines]);
    TextDrawHideForPlayer(playerid, Fine[playerid]);
    PlayerWanted(playerid);
    return 1;
}
It's not showing the message, but it's showing You have paided your fines!
Reply
#8

which message?
Reply
#9

Код:
(3628) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
line 3628
Код:
return 1;
Код:
CMD:fine(playerid, params[])
{
	new string2[256];
    if(GetPlayerTeam(playerid) != TEAM_COP) return SendClientMessage(playerid, COLOUR_RED, "Only Cops can use this command.");
    {
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
            {
                if(GetPlayerWantedLevel(player1) <= 1)
                {
                        if(!IsPlayerInAnyVehicle(player1))
                        {
                            if (GetDistanceBetweenPlayers(playerid, player1) < 10)
                            {
                                GetPlayerName(player1, playername, sizeof(playername));
                                GetPlayerName(playerid, adminname, sizeof(adminname));
                                format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
                                SendClientMessage(player1, -1, string);
                                SetPVarInt(player1, "Fine", 1);
                                SetPVarInt(player1, "Issuerid", playerid);
                                format(string2, sizeof(string2), "Officer %s has given %s a ticket", adminname, playername);
                                //Copstats[playerid][Tickets]++;
                                return SendClientMessageToAll(-1, string2);
                            }
                            else return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
                        }
                        else return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
                }
                else return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            }
            else return SendClientMessage(playerid, -1, "ERROR: Player not found");
    }
    return 1;
}
Reply
#10

pawn Код:
CMD:fine(playerid, params[])
{
        new string2[256];
        if(GetPlayerTeam(playerid) != TEAM_COP) return SendClientMessage(playerid, COLOUR_RED, "Only Cops can use this command.");
            if(!strlen(params)) return SendClientMessage(playerid, -1, "Usage: /ticket [Player Id]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(params);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "ERROR: Player not found");
            if(GetPlayerWantedLevel(player1) <= 1) return SendClientMessage(playerid, -1, "ERROR: This player does not have 1 or more  wanted level!");
            if(!IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid, -1, "ERROR: Player is in a vehicle!");
            if (GetDistanceBetweenPlayers(playerid, player1) < 10) return SendClientMessage(playerid, -1, "ERROR: You need to be close to the player to give him a ticket.");
            GetPlayerName(player1, playername, sizeof(playername));
            GetPlayerName(playerid, adminname, sizeof(adminname));
            format(string,sizeof(string),"Officer %s has given you a ticket.",adminname);
            SendClientMessage(player1, -1, string);
            SetPVarInt(player1, "Fine", 1);
            SetPVarInt(player1, "Issuerid", playerid);
            format(string2, sizeof(string2), "Officer %s has given %s a ticket", adminname, playername);
            //Copstats[playerid][Tickets]++;
            SendClientMessageToAll(-1, string2);
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)