freak error value assigned to a variable
#1

i write
Код:
new este_masina_sport[MAX_PLAYERS];
		este_masina_sport[playerid] = 2;
but when i check with
Код:
SendClientMessage(playerid,0xFF0000FF, este_masina_sport[playerid]);
the server send to me " " (nothing)
Reply
#2

You need to format the string first, then send the formatted string.
Reply
#3

pawn Код:
new string[256];
format(string,sizeof(string),"%d",este_masina_sport[playerid]);
SendClientMessage(playerid,COLOR_RED,string);
you have to use string with this case.
Reply
#4

Quote:
Originally Posted by Eth
Посмотреть сообщение
pawn Код:
new string[256];
format(string,sizeof(string),"%d",este_masina_sport[playerid]);
SendClientMessage(playerid,COLOR_RED,string);
you have to use string with this case.
Are you crazy!? Using 256 for a string length?

https://sampforum.blast.hk/showthread.php?tid=55261
Reply
#5

my probles is that este_masina_sport don't assigned value because in far where i check if value is 2 nothing happened like that isn't 2

i check with format and it show me 2 but on

if(este_masina_sport[playerid] == 2)
{
do stuff
}

it didn't do the stuff
Reply
#6

Quote:
Originally Posted by ROMDash
Посмотреть сообщение
Are you crazy!? Using 256 for a string length?

https://sampforum.blast.hk/showthread.php?tid=55261
When should I use 256?
Quote:

Having said all this, there are times when large arrays may be useful, but they should be used sparingly only when needed.


reed the post again -_- there is no harm by doing 256...
Reply
#7

Quote:
Originally Posted by Eth
Посмотреть сообщение
When should I use 256?




reed the post again -_- there is no harm by doing 256...
You have no idea what you're saying. Using 256 for string is weird, and he only needs like 2 decimal to be formatted not 256 ! Wastage of memory.
Reply
#8

and my problem
Reply
#9

Quote:
Originally Posted by Eth
Посмотреть сообщение
When should I use 256?




reed the post again -_- there is no harm by doing 256...
Quote:

Having said all this, there are times when large arrays may be useful, but they should be used sparingly only when needed.
This time, it isn't needed. And in practice if you're going to use 256 all the time when it's not needed it's not going to look good. Anyway, this isn't a debate topic for string sizes.

To the OP: I'm finding it hard to understand you in your last post, could you explain again in more detail?
Reply
#10

Код:
if(GetVehicleModel(GetClosestVehicle(playerid, 10)) != 0)
					        	{   ems[playerid] = 2;
							        for(new i; i <= sizeof(masina_sport); i++)
										{
										    if(GetVehicleModel(GetClosestVehicle(playerid, 10)) == masina_sport[i][model_m_m] )
										        {
													ems[playerid] = 1;
										            SendClientMessage(playerid,0xFF0000FF, "Nu ai reusit sa spargi incuietoarea.");
                                                    new Float:vehx, Float:vehy, Float:vehz;
												    GetVehiclePos(GetClosestVehicle(playerid, 10), vehx, vehy, vehz);
												    SetTimerEx("alarma_masina",1000, false, "iifff", playerid,0, vehx, vehy, vehz);
													for(new j; j <= MAX_PLAYERS; j++)
														{
														    if (IsPlayerInRangeOfPoint(j, 20.0, vehx, vehy, vehz) && j!=playerid)
														    	{
																	SendClientMessage(playerid,0xFF0000FF, "Vei primi wanted 6 deoarece cineva a auzit alarma.");
                                                                    SetTimerEx("alarma_masina",1000, false, "iifff", j,0, vehx, vehy, vehz);
                                                                    SetPlayerWantedLevel(playerid, 6);
                                                                    wanted_level[playerid] = 6;
																}
														}
                                                    if(wanted_level[playerid] == 0)
														{
															SendClientMessage(playerid,0xFF0000FF, "De data asta ai scapat, nu a auzit nimeni alarma.");
														}
												}
										}
									if(ems[playerid] == 2)
										{
											new incercare[MAX_PLAYERS];
											incercare[playerid] = random(10);
											if(incercare[playerid]<3)
												{
											    	SendClientMessage(playerid,0xFF0000FF, "Nu ai reusit sa spargi incuietoarea.");
		                                            new Float:vehx, Float:vehy, Float:vehz;
													GetVehiclePos(GetClosestVehicle(playerid, 10), vehx, vehy, vehz);
													SetTimerEx("alarma_masina",1000, false, "iifff", playerid,0, vehx, vehy, vehz);
													for(new j; j <= MAX_PLAYERS; j++)
														{
.... and very much stuffs...
i set ems[playerid] = 2, ok?

if is check brown condition ems[playerid] = 1 and rest of part was executed.
if isn't check it is blocked. After for nithing was not executed. why?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)