Smal help
#1

Well, WHy is this not working?

PHP код:
new cost random(3000); 
Any idea?

I added this for cmd:ticket and cmd: pay

I want it shows you cop and to crminal

for example:

If a cop issued a ticket to criminal

PHP код:
format(stringsizeof(string), "You have issued a ticket to %s (%d). Cost: $%d. Please wait until you get paid"NAMEIDcost);
               
SendClientMessage(playeridAZULstring);
               
format(stringsizeof(string), "{6A5ACD}You have been issued a ticket by %s (%d). Cost: $%d"copplayeridcost);
               
SendClientMessage(IDAZULstring); 
and now this is on cmd ay

PHP код:
format(stringsizeof(string), "You have paid your ticket. Cost: %d"cost);
    
SendClientMessage(playeridGREENstring); 
So, I m not adding this cost in my cmds. I just made it like this cuz im using cost in cmd: pay and also on cmd:ticket
PHP код:
new cost random(3000);
new 
ticketed[MAX_PLAYERS];
CMD:ticket(playeridparams[])

So, the problem is whenever i compile it it shows me ERROR that pwn has stopped working.

And it's because of this line:

new cost = random(3000);

any idea how to show ticket amount in pay and ticket cmds. ?
Reply
#2

Isn't cost a global var? If someone gets ticketed and another person does. If the 1st person does it he will have to play the 2nd persons ticket.

Crash, you might have a open { somewhere in your script.
Reply
#3

============
Reply
#4

That is indeed a global var (which doesn't mean someone elses script).
A global variable is a variable that is accessable throughout the entire script.

The random value will be created when you start the server, and will stay the same until you restart.
So lets say, you start the server and the value is now 1298. Cost == 1298. Cost will ALWAYS be 1298 until you restart your server.

You need to implement new cost = random(3000); inside the /ticket command.

And the code
pawn Код:
new code = random(3000);
is NOT the reason for PAWN compiler to crash, even if it seems that way. The variable is correctly done.
Very often a code before or after a certain code snippet might be at fault even if it doesn't seem that way...
Reply
#5

OKay, How can i show cost in 2 cmds at same time?

Like you are a cop and im a robber

you issued me a ticket

it's for /ticket cmd
This msg for you: you (0) issued a ticket to me (1). COst $551

Now when i type /pay

it should be like this: You have paid the ticket: Cost $551

How can i use it in 2 cmds.
Reply
#6

You can create a ticketcost[playerid] variable and save the cost for the ticket for the player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)