crash
#4

It may very well be that your cache_get_data has wrong parameters passed to it. The 3rd parameter needs to be the connection ID value, so replace it with duomenys (which is apparently the array you store the connection ID in).

The source of your problem is this line:
pawn Код:
cache_get_row(0, 3, timeban[playerid], data);
Your query returns ONE FIELD, but you're asking the script to look for the FOURTH FIELD - this will not work. Please learn that the numbering of the returned fields is RELATIVE TO THE QUERY itself, so doing
SELECT name FROM players WHERE id=1;
will return ONE FIELD with the index of 0.

Furthermore, you could optimize your whole process a bit by never even calling the query for NPCs. What you currently do is call the query, but don't process its result? What's the point of this? Simply don't execute the query in case the player is a NPC.

// EDIT:
About the declaration of arrays with default values.
Something like this will not work indeed (it may, well, but I'm quite sure it won't do what you want it to):
pawn Код:
new Array[20] = 1;
Instead, you need to use code like this:
pawn Код:
new Array[20] = {1, ...};
This will set all the values in the array (indexes 0-19) to 1.

Doing
pawn Код:
new Array[20] = {0, ...};
is not necessary as values are set to 0 by default.

Good luck coding!
Reply


Messages In This Thread
crash - by speed258 - 02.03.2013, 09:33
Re: crash - by ¤Adas¤ - 02.03.2013, 09:47
Re: crash - by speed258 - 02.03.2013, 09:54
Re: crash - by AndreT - 02.03.2013, 09:54
Re: crash - by speed258 - 02.03.2013, 10:04
Re: crash - by speed258 - 03.03.2013, 16:24

Forum Jump:


Users browsing this thread: 1 Guest(s)