Client crush on Connect (Compiles without any error)
#1

Since i created a loop for my cars to make an unique id, when i connect to server my client crushes, there is the code:
the code which sets values for arrays:
Код:
	new ucarsquery[128];
	new usercar[11][128];
	new cars;
	format(ucarsquery, sizeof(ucarsquery), "SELECT owner,modelid,spawn_x,spawn_y,spawn_z,angle,color1,color2,tune,locked FROM `ucars`");
	samp_mysql_query(ucarsquery);
	samp_mysql_store_result();
	while(samp_mysql_fetch_row(ucarsquery)) {
		split(ucarsquery, usercar, '|');
		playercar[cars][car_owner] = strval(usercar[0]);
		playercar[cars][car_modelid] = strval(usercar[1]);
		playercar[cars][car_spawnX] = floatstr(usercar[2]);
		playercar[cars][car_spawnY] = floatstr(usercar[3]);
		playercar[cars][car_spawnZ] = floatstr(usercar[4]);
		playercar[cars][car_spawnA] = floatstr(usercar[5]);
		playercar[cars][car_color1] = strval(usercar[6]);
		playercar[cars][car_color2] = strval(usercar[7]);
		playercar[cars][car_tune] = strval(usercar[8]);
		playercar[cars][car_locked] = strval(usercar[9]);
		playercar[cars][car_id] = CreateVehicle(playercar[1][car_modelid],playercar[1][car_spawnX],playercar[1][car_spawnY],playercar[1][car_spawnZ],playercar[1][car_spawnA],playercar[1][car_color1],playercar[1][car_color2],-1);
		cars++;
	}
The code which uses them to check (OnPlayerConnect):
Код:
		for (new cars=0;cars<1000; cars++) {
			if (!strcmp(playercar[cars][car_owner], playerinfo[playerid][nickname])) {
				for (players=0;players<MAX_PLAYERS; players++) {
					SetVehicleParamsForPlayer(playercar[cars][car_id],players,0,1);
				}
			} else {
				SetVehicleParamsForPlayer(playercar[cars][car_id],playerid,1,0);
			}
		}
Where is the problem that causes my client to crush?

EDIT: Problem is in the first part of the script, because when i delete it, everything goes fine.
I think the problem is because of cars++; on the bottom of the while function, can't you do that in pawno like in php? so that each while cars value would increase by 1...? If so, how can i do that ?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)