ummm why does this stop? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ummm why does this stop? (
/showthread.php?tid=254732)
ummm why does this stop? -
THE_KNOWN - 12.05.2011
Код:
stock ModVeh(playerid)
{
new q[64];
mysql_debug(1);
format(q,128,"SELECT `1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`,`13` FROM vehs WHERE Name='%s'",getname(playerid));
mysql_query(q);
mysql_store_result();
mysql_fetch_row_format(q,"|");
new cmod[13][32];
explode(q,cmod,"|");
AddVehicleComponent(tvid[playerid],strval(cmod[0]));
AddVehicleComponent(tvid[playerid],strval(cmod[1]));
AddVehicleComponent(tvid[playerid],strval(cmod[2]));
AddVehicleComponent(tvid[playerid],strval(cmod[3]));
AddVehicleComponent(tvid[playerid],strval(cmod[4]));
AddVehicleComponent(tvid[playerid],strval(cmod[5]));
AddVehicleComponent(tvid[playerid],strval(cmod[6]));
AddVehicleComponent(tvid[playerid],strval(cmod[7]));
AddVehicleComponent(tvid[playerid],strval(cmod[8]));
AddVehicleComponent(tvid[playerid],strval(cmod[9]));
AddVehicleComponent(tvid[playerid],strval(cmod[10]));
AddVehicleComponent(tvid[playerid],strval(cmod[11]));
AddVehicleComponent(tvid[playerid],strval(cmod[12]));
printf("%d",cmod[4]);
mysql_free_result();
mysql_debug(0);
return 1;
}
something wrong? when i debuged the mysql part the components are saved in the DB and are fetched when the ModVeh() is called. but i think add vehicle component is stopping it any idea why?
EDIT:
Better code:
pawn Код:
stock ModVeh(playerid)
{
new q[64];
format(q,128,"SELECT `1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`,`13` FROM vehs WHERE Name='%s'",getname(playerid));
mysql_query(q);
mysql_store_result();
mysql_fetch_row_format(q,"|");
new cmod[13][32];
explode(q,cmod,"|");
for(new i=0;i<13;i++)
{
if(strval(cmod[i]) == 0) { printf("%d",strval(cmod[i])); continue; }
printf("%d",strval(cmod[i]));
AddVehicleComponent(tvid[playerid],strval(cmod[i]));
}
mysql_free_result();
print("modded");
return 1;
}
hmm it seems to crash even with a correct id
Re: ummm why does this stop? -
Vince - 12.05.2011
What does the mysql_log say? My guess: Your string is too short to store the entire result, thus bugging up.
Re: ummm why does this stop? -
THE_KNOWN - 12.05.2011
oh lol idk it say it successfully executed it in log so i didnt care. but it turned out to be like it was changing the vehicle id to 118 for some reason. i changed the size to 12 8and it worked. anyway thanks for trying
Re: ummm why does this stop? -
THE_KNOWN - 12.05.2011
sry for DP but can you tell me how to calculate the required lenght? like how did you know the string was too short etc
Re: ummm why does this stop? -
__ - 12.05.2011
Common sense and basic mathematics...