command crashes server
#1

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);
            }
       
        }
Reply
#2

format(xstring, sizeof(xstring),"%s you bought a new insurance

I think its %d no ?
Reply
#3

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.
Reply
#4

Just o_O" What a noob error i've made !
Reply
#5

Are you sure the MySQL server exists?

@Above: No, %s is right
Reply
#6

Quote:
Originally Posted by Vukilore
Посмотреть сообщение
Just o_O" What a noob error i've made !
Don't worry, no-one's perfect :P
Reply
#7

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 :\
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)