command crashes server - 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: command crashes server (
/showthread.php?tid=245029)
command crashes server -
Hornet600 - 29.03.2011
I don't know what is wrong with this code but this is crashing the server
pawn Код:
if(strcmp(x_v,"buyinsurance",true) == 0)
{
new carkey = playerinfo[playerid][vkey];
if(IsPlayerInVehicle(playerid, carkey))
{
vehicleinfo[carkey][Insurances] = (vehicleinfo[carkey][Insurances] +1);
vehicleinfo[carkey][InsurancePrice] = (vehicleinfo[carkey][InsurancePrice] +500);
format(query, sizeof(query),"UPDATE vehicles SET Insurances=%d,InsurancePrice=%d WHERE carid=%d",
vehicleinfo[currentplayervehicle[playerid]][Insurances],vehicleinfo[currentplayervehicle[playerid]][InsurancePrice],currentplayervehicle[playerid]);
mysql_query(query);
new xstring[120];
format(xstring, sizeof(xstring),"%s you bought a new insurance for your vehicle.",playerinfo[playerid][Name]);
SendClientMessage(playerid, COLOR_GREEN, string);
}
}
Re : command crashes server -
Vukilore - 29.03.2011
format(xstring, sizeof(xstring),"%s you bought a new insurance
I think its %d no ?
Re: Re : command crashes server -
WillyP - 29.03.2011
Quote:
Originally Posted by Vukilore
format(xstring, sizeof(xstring),"%s you bought a new insurance
I think its %d no ?
|
%s for strings, %d for numbers.
Re : command crashes server -
Vukilore - 29.03.2011
Just o_O" What a noob error i've made !
Re: command crashes server -
Jochemd - 29.03.2011
Are you sure the MySQL server exists?
@Above: No, %s is right
Re: Re : command crashes server -
WillyP - 29.03.2011
Quote:
Originally Posted by Vukilore
Just o_O" What a noob error i've made !
|
Don't worry, no-one's perfect :P
Re: command crashes server -
Hornet600 - 29.03.2011
i was afk. and no is not %d. its a string :P. yes the mysql server exists and i dunno why this is crashing the server :\