[Help] 2 problems
#1

Hello so i am having some problems when i try to /ticket it says "You're not being ticketed" as also shown in this screenshot and it wont let me accept it

http://i.imgur.com/ZBpbyC7.jpg

Код:
else if(strcmp(Usage, "CopTicket", true) == 0)
		{
		    if(Player[playerid][BeingTicketed] > 0)
		    {
		        if(IsPlayerConnectedEx(Player[playerid][BeingTicketed]))
		        {
					format(string, sizeof(string), "[TICKET] %s has been ticketed by %s, for $%d.", GetName(playerid), GetNameWithUnderscore(Player[playerid][BeingTicketed]), Player[Player[playerid][BeingTicketed]][TicketPrice]);
					MoneyLog(string);
			        Player[playerid][Money] -= Player[Player[playerid][BeingTicketed]][TicketPrice];
			        Player[Player[playerid][BeingTicketed]][Money] += Player[Player[playerid][BeingTicketed]][TicketPrice];
					SendClientMessage(playerid, WHITE, "You have accepted the ticket.");
					SendClientMessage(Player[playerid][BeingTicketed], WHITE, "The other party has accepted the ticket.");
                    Player[Player[playerid][BeingTicketed]][TicketPrice] = 0;
                    Player[Player[playerid][BeingTicketed]][Ticketing] = -1;
					Player[playerid][BeingTicketed] = -1;
				}
		    }
		    else
		    {
		        SendClientMessage(playerid, WHITE, "You're not being ticketed.");
		    }
		}
Код:
command(ticket, playerid, params[])
{
	new price, id, string[128];
	if(sscanf(params, "ud", id, price))
	{
		SendClientMessage(playerid, WHITE, "SYNTAX: /ticket [playerid] [price]");
	}
	else
	{
	    if(IsPlayerConnectedEx(id))
	    {
	        if(GetDistanceBetweenPlayers(playerid, id) < 7)
	        {
	            if(Groups[Player[playerid][Group]][CommandTypes] == 1)
	            {
	                format(string, sizeof(string), "* %s writes out a ticket and hands it to %s.", GetName(playerid), GetName(id));
	                NearByMessage(playerid, SCRIPTPURPLE, string);
	                format(string, sizeof(string), "You have written a ticket to %s, for $%d.", GetName(id), price);
	                SendClientMessage(playerid, WHITE, string);
	                format(string, sizeof(string), "You have been written a ticket, from LEO %s, the price is $%d. type /accept copticket to accept the ticket", GetName(playerid), price);
	                SendClientMessage(id, ANNOUNCEMENT, string);
	                Player[playerid][TicketPrice] = price;
	                Player[playerid][Ticketing] = id;
	                Player[id][BeingTicketed] = playerid;
	            }
	            else
	            {
	                SendClientMessage(playerid, WHITE, "You're not a LEO.");
	            }
	        }
	        else
	        {
	            SendClientMessage(playerid, WHITE, "You're too far away.");
	        }
	    }
	    else
	    {
	        SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
	    }
	}
	return 1;
and my second problem is when i try to do /fine i type in the price and reason but nothing comes up and it doesnt even remove the money from the player

Код:
command(fine, playerid, params[])
{
	new id, amount, Reason[128], string[128];
	if(sscanf(params, "udz", id, amount, Reason))
	{
	    if(Player[playerid][AdminLevel] >= 2)
	    {
			SendClientMessage(playerid, WHITE, "SYNTAX: /fine [playerid] [amount] [reason]");
		}
	}
	else
	{
		if(Player[playerid][AdminLevel] >= 2)
		{
		    if(strlen(Reason) < 1)
		    {
		        SendClientMessage(playerid, WHITE, "SYNTAX: /fine [playerid] [amount] [reason]");
		    }
		    else
		    {
		        if(Player[id][AdminLevel] < Player[playerid][AdminLevel])
		        {
			        if(amount < 99999999 && amount >= 1)
			        {
				    	format(string, sizeof(string), "Fine: %s has been fined $%s by %s, defined reason: %s", GetName(id), IntToFormattedStr(amount), Player[playerid][AdminName], Reason);
				    	SendClientMessageToAll(LIGHTRED, string);
				    	Player[id][Money] -= amount;

				        if(Player[id][AdminLevel] < 1)
				        {
				        	Player[playerid][AdminActions]++;
				        	AdminActionsLog(string);
			            	SendClientMessage(playerid, WHITE, "You have earned a Jason Point!");
				        }
			    	}
		    	}
		    }
		}
	}
	return 1;
}
Reply
#2

1. Because playerid is probably 0 here
Player[id][BeingTicketed] = playerid;

and you check
if(Player[playerid][BeingTicketed] > 0)

its not higher than 0 then you sets to -1
Player[playerid][BeingTicketed] = -1;

so sholud be
if(Player[playerid][BeingTicketed] > -1)
or
if(Player[playerid][BeingTicketed] >= 0)

2. Try to use s[125] instead of z

pawn Код:
command(fine, playerid, params[])
{
    new id, amount, Reason[125];
    if(sscanf(params, "uds[125]", id, amount, Reason))
    {
        if(Player[playerid][AdminLevel] >= 2)
            SendClientMessage(playerid, WHITE, "SYNTAX: /fine [playerid] [amount] [reason]");
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 2)
            if(Player[id][AdminLevel] < Player[playerid][AdminLevel])
                if(0 < amount < 99999999)
                {
                    new string[128];
                    format(string, sizeof(string), "Fine: %s has been fined $%s by %s, defined reason: %s", GetName(id), IntToFormattedStr(amount), Player[playerid][AdminName], Reason);
                    SendClientMessageToAll(LIGHTRED, string);
                    Player[id][Money] -= amount;

                    if(Player[id][AdminLevel] < 1)
                    {
                        Player[playerid][AdminActions]++;
                        AdminActionsLog(string);
                        SendClientMessage(playerid, WHITE, "You have earned a Jason Point!");
                    }
                }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Jefff
Посмотреть сообщение
1. Because playerid is probably 0 here
Player[id][BeingTicketed] = playerid;

and you check
if(Player[playerid][BeingTicketed] > 0)

its not higher than 0 then you sets to -1
Player[playerid][BeingTicketed] = -1;

so sholud be
if(Player[playerid][BeingTicketed] > -1)
or
if(Player[playerid][BeingTicketed] >= 0)

2. Try to use s[125] instead of z

pawn Код:
command(fine, playerid, params[])
{
    new id, amount, Reason[125];
    if(sscanf(params, "uds[125]", id, amount, Reason))
    {
        if(Player[playerid][AdminLevel] >= 2)
            SendClientMessage(playerid, WHITE, "SYNTAX: /fine [playerid] [amount] [reason]");
    }
    else
    {
        if(Player[playerid][AdminLevel] >= 2)
            if(Player[id][AdminLevel] < Player[playerid][AdminLevel])
                if(0 < amount < 99999999)
                {
                    new string[128];
                    format(string, sizeof(string), "Fine: %s has been fined $%s by %s, defined reason: %s", GetName(id), IntToFormattedStr(amount), Player[playerid][AdminName], Reason);
                    SendClientMessageToAll(LIGHTRED, string);
                    Player[id][Money] -= amount;

                    if(Player[id][AdminLevel] < 1)
                    {
                        Player[playerid][AdminActions]++;
                        AdminActionsLog(string);
                        SendClientMessage(playerid, WHITE, "You have earned a Jason Point!");
                    }
                }
    }
    return 1;
}
It does not say You're not being ticketed anymore but it doesnt remove the money i set the ticket to 1 dollar but i still have the 1 dollar i used the code (Player[playerid][BeingTicketed] > -1)

and for the /fine thing all i get is SYNTAX: /fine [playerid] [amount] [reason] even though i enter everything
Reply
#4

Use prints in CopTicket and show results
pawn Код:
printf("before: %d - %d | %d",Player[playerid][Money],Player[Player[playerid][BeingTicketed]][Money],Player[Player[playerid][BeingTicketed]][TicketPrice]);
Player[playerid][Money] -= Player[Player[playerid][BeingTicketed]][TicketPrice];
Player[Player[playerid][BeingTicketed]][Money] += Player[Player[playerid][BeingTicketed]][TicketPrice];
printf("after: %d - %d | %d",Player[playerid][Money],Player[Player[playerid][BeingTicketed]][Money],Player[Player[playerid][BeingTicketed]][TicketPrice]);
and in cmd /fine
pawn Код:
if(sscanf(params, "uds[125]", id, amount, Reason))
{
    printf("id: %d, amount: %d, Reason: %s",id, amount, Reason);
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Use prints in CopTicket and show results
pawn Код:
printf("before: %d - %d | %d",Player[playerid][Money],Player[Player[playerid][BeingTicketed]][Money],Player[Player[playerid][BeingTicketed]][TicketPrice]);
Player[playerid][Money] -= Player[Player[playerid][BeingTicketed]][TicketPrice];
Player[Player[playerid][BeingTicketed]][Money] += Player[Player[playerid][BeingTicketed]][TicketPrice];
printf("after: %d - %d | %d",Player[playerid][Money],Player[Player[playerid][BeingTicketed]][Money],Player[Player[playerid][BeingTicketed]][TicketPrice]);
and in cmd /fine
pawn Код:
if(sscanf(params, "uds[125]", id, amount, Reason))
{
    printf("id: %d, amount: %d, Reason: %s",id, amount, Reason);
I still get the same problem as before /ticket wont take the money /fine its just giving me the Syntax
Reply
#6

Here.

PHP код:
CMD:fine(playeridparams[])
{
    new 
string[128], giveplayeridamountreason[64];
    if(
sscanf(params"uds"giveplayeridamountreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /fine [playerid/partofname] [amount] [reason]");
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
         if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 2)
        {
       
        }
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
amount 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Amount must be greater than 0");
                return 
1;
            }
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
ABroadCast(COLOR_LIGHTREDstring1);
            
format(stringsizeof(string), "> {FF0606}You have been fined $%d by %s for %s"amountGetPlayerNameEx(playerid), reason);
            
SendClientMessageEx(giveplayeridCOLOR_YELLOWstring);
            
GivePlayerCash(giveplayerid, -amount);
            return 
1;
        }
        else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"You're not a level 2 admin.");
    }
    return 
1;

Reply
#7

Quote:
Originally Posted by XBrianX
Посмотреть сообщение
Here.

PHP код:
CMD:fine(playeridparams[])
{
    new 
string[128], giveplayeridamountreason[64];
    if(
sscanf(params"uds"giveplayeridamountreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /fine [playerid/partofname] [amount] [reason]");
    if(
PlayerInfo[playerid][pAdmin] >= 2)
    {
         if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 2)
        {
       
        }
        if(
IsPlayerConnected(giveplayerid))
        {
            if(
amount 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Amount must be greater than 0");
                return 
1;
            }
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
ABroadCast(COLOR_LIGHTREDstring1);
            
format(stringsizeof(string), "> {FF0606}You have been fined $%d by %s for %s"amountGetPlayerNameEx(playerid), reason);
            
SendClientMessageEx(giveplayeridCOLOR_YELLOWstring);
            
GivePlayerCash(giveplayerid, -amount);
            return 
1;
        }
        else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"You're not a level 2 admin.");
    }
    return 
1;

Does not work i get error

Код:
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30422) : error 017: undefined symbol "COLOR_WHITE"
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30424) : error 017: undefined symbol "PlayerInfo"
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30424) : warning 215: expression has no effect
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30424) : error 001: expected token: ";", but found "]"
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30424) : error 029: invalid expression, assumed zero
C:\Users\Will\Desktop\Desktop items\Servers\RP\gamemodes\VortexRoleplay.pwn(30424) : fatal error 107: too many error messages on one line

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


5 Errors.
Reply
#8

Anyone else know how to fix this?
Reply
#9

Can someone help me with this please ?
Reply
#10

PHP код:
#define COLOR_WHITE                0xFFFFFFAA

CMD:fine(playeridparams[])
{
    new 
string[128], giveplayeridamountreason[64];
    if(
sscanf(params"uds"giveplayeridamountreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /fine [playerid/partofname] [amount] [reason]");

    if(
Player[playerid][AdminLevel] >= 2) {
    {
         if(
Player[playerid][AdminLevel] < 2)
        {

        }

        if(
IsPlayerConnected(giveplayerid))
        {
            if(
amount 1)
            {
                
SendClientMessage(playeridCOLOR_GRAD2"Amount must be greater than 0");
                return 
1;
            }
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "AdmCmd: %s was fined $%d by %s, reason: %s"GetPlayerNameEx(giveplayerid), amountGetPlayerNameEx(playerid), reason);
            
ABroadCast(COLOR_LIGHTREDstring1);
            
format(stringsizeof(string), "> {FF0606}You have been fined $%d by %s for %s"amountGetPlayerNameEx(playerid), reason);
            
SendClientMessageEx(giveplayeridCOLOR_YELLOWstring);
            
GivePlayerCash(giveplayerid, -amount);
            return 
1;
        }
        else 
SendClientMessage(playeridCOLOR_GRAD1"Invalid player specified.");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_WHITE"You're not a level 2 admin.");
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)