Passing color code
#1

Hi,
I got this code:

pawn Код:
public SendServerMessage(playerid, color, text[])
{
    if(Wait[playerid] == 1)
    {
        SetTimerEx("SendServerMessage",WaitTime+50,0,"dss",playerid,color,text);
        return 1;
    }
//...
}
But it crashes the server... More info: http://forum.sa-mp.com/showpost.php?...09&postcount=5
Reply
#2

It's working fine for me, what type of variable are you using for "WaitTime"?
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
It's working fine for me, what type of variable are you using for "WaitTime"?
It's on top of my script:
#define WaitTime 500
Reply
#4

Strange, I don't get any errors on that line using the same code as you!
Reply
#5

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Strange, I don't get any errors on that line using the same code as you!
Oh wait.. My bad.. I don't get error anymore, but the server crashes just when it starts..
If I comment that line, everything works..

crashinfo:
Quote:

--------------------------

SA-MP Server: 0.3c RC4



Exception At Address: 0x00406A28



Registers:

EAX: 0x00000000 EBX: 0x00003564 ECX: 0x00000000 EDX: 0x00000000

ESI: 0x0317437C EDI: 0x00000000 EBP: 0x0139CC00 ESP: 0x0012FD84

EFLAGS: 0x00010246



Stack:

+0000: 0x0139CC00 0x030FF780 0x030C55AC 0x00000000

+0010: 0x03102CE4 0x00000000 0x00402C20 0x0139CC00

+0020: 0x00000000 0x0294EA20 0x00000003 0x00000003

+0030: 0x0139CC00 0x00003564 0x0000317C 0x00074BFC

+0040: 0x00074C2C 0x00070C30 0x00074C14 0x00070C30

+0050: 0x030C1C14 0x030FF780 0x656E6E6F 0x030C0020

+0060: 0x0003DB6C 0x00490ABA 0x0139CC00 0x0012FE18

+0070: 0x00000052 0x01448E98 0x760FEF66 0x3BA40330

+0080: 0x014482E0 0x0294EA20 0x00000052 0x014482E0

+0090: 0x0294EA40 0x000001F4 0x0049B864 0x00000005

+00A0: 0x760FEFA0 0x760FF292 0x00000000 0x3BA40330

+00B0: 0x004980CC 0x00000000 0x00001DB0 0x0012FF88

+00C0: 0x7FFD5000 0x00015000 0x00010101 0x00000078

+00D0: 0x00001F55 0x00000078 0x000018D4 0x01448E98

+00E0: 0x656D6167 0x65646F6D 0x00003531 0x004CA014

+00F0: 0x004CA010 0x7FFD5000 0x004B4B90 0x0012FE70

+0100: 0x0012FE68 0x0012FF78 0x004A6AC4 0x004C1378

+0110: 0xFFFFFFFF 0x004A4D81 0x004A4D91 0x004B4B90

+0120: 0x0012FF78 0x004B4811 0xFFFFFFFF 0x004A6562

+0130: 0x00000001 0x014414A8 0x014414E8 0x00000094

Reply
#6

Works fine for me too.
Reply
#7

You are passing the color variable as a string in the timer. Change it to an integer/decimal:
pawn Код:
SetTimerEx("SendServerMessage",WaitTime+50,0,"dds",playerid,color,text); // dds instead of dss
This would explain why it compiles fine, but then crashes when it tries to give your color parameter a string value.
Reply
#8

Quote:
Originally Posted by Benjo
Посмотреть сообщение
You are passing the color variable as a string in the timer. Change it to an integer/decimal:
pawn Код:
SetTimerEx("SendServerMessage",WaitTime+50,0,"dds",playerid,color,text); // dds instead of dss
This would explain why it compiles fine, but then crashes when it tries to give your color parameter a string value.
Tried that, still crashes..
Reply
#9

Still waiting for a solution.. :S
Reply
#10

This might be a long shot, but if you are using 0.3c (RC's) make sure you have the latest includes.

And back to Benjo's point, surely the colour variable should be passed as a hexadecimal? (Format as: x)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)