stock SaveCar(playerid)
{
new tr = playerCar1[playerid],
Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective;
static Float:lastPosition[4], Float:bukles;
GetVehiclePos(tr, lastPosition[0], lastPosition[1], lastPosition[2]);
GetVehicleZAngle(tr, lastPosition[3]);
GetVehicleParamsEx (tr, Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective);
GetVehicleHealth(tr, bukles);
if ( playerCar1 [ playerid ] != -1 )
{
format(g_szBuffer, sizeof g_szBuffer,
"UPDATE "MySQL_VEHICLE_TABLE" SET \
\
uzraktas = %i, \
degalai = %f, \
statusas = %i, \
variklis = %i, \
bukle = %f, \
numeriai = %s, \
rida = %f, \
posX = %f, \
posY = %f, \
posZ = %f, \
posA = %f, \
technikine = %i, \
techlaikas = %i \
\
WHERE savininkas = %s",
masina[ tr ][ lock ],
masina[ tr ][ Gas ],
masina[ tr ][ status ],
Engine,
bukles,
masina[ tr ][vehNumber],
masina[ tr ][ vehRida ],
lastPosition[0],
lastPosition[1],
lastPosition[2],
lastPosition[3],
masina[ tr ][ vehTech ],
masina[ tr ][ vehTechtime ],
getPlayerName(playerid));
sql_query(sql, g_szBuffer, QUERY_THREADED);
printf("%s transportas isaugotas ( %f , %f, %f, %f )", getPlayerName(playerid),lastPosition[0], lastPosition[1], lastPosition[2], lastPosition[3]);
}
DestroyVehicle(tr);
}
[07:52:43] Iam_Satan transportas isaugotas ( -2048.752929 , 307.547454, 40.620113, 49.947959 )
[21:24:36][debug] Natives::sql_query: Scheduling statement (stmt->id = 16, stmt->query = UPDATE vehicles SET uzraktas = 0, degalai = 40.000000, statusas = 0, variklis = 1, bukle = 789.740234, numeriai = NEREGISTRUOTA, rida = 0.000000, posX = -2276.572265, posY = 365.594726, posZ = 33.922851, posA = 229.472518, technikine = 0, techlaikas = 0 WHERE savininkas = Iam_Satan, stmt->callback = ) for execution...
[21:24:36][debug] SQL_Worker[1]: Executing query (stmt->id = 16, stmt->query = UPDATE vehicles SET uzraktas = 0, degalai = 40.000000, statusas = 0, variklis = 1, bukle = 789.740234, numeriai = NEREGISTRUOTA, rida = 0.000000, posX = -2276.572265, posY = 365.594726, posZ = 33.922851, posA = 229.472518, technikine = 0, techlaikas = 0 WHERE savininkas = Iam_Satan)...
WHERE savininkas = 'Iam_Satan'
Код:
WHERE savininkas = 'Iam_Satan' |
stock getPlayerSqlID(pid) return player[pid][pSqlID];
stock setPlayerSqlID(pid, id) player[pid][pSqlID] = id;
stock playerExist(pid)
{
new const Result:r = sql_query(sql,
f("SELECT id FROM "MySQL_PLAYERS_TABLE" WHERE pName = '%s'", getPlayerName(pid)),
QUERY_CACHED
);
if(sql_num_rows(r))
{
setPlayerSqlID(pid, sql_get_field_assoc_int(r, "id"));
return true;
} else {
return false;
}
}
stock registerPlayer(pid)
{
inline register(id, did, response, listitem, string:inputtext[])
{
#pragma unused id, did, listitem
if(response)
{
if(isnull(inputtext))
{
registerPlayer(pid);
} else {
new pw[130];
WP_Hash(pw, sizeof pw, inputtext);
new const Result:r = sql_query(sql,
f("INSERT INTO "MySQL_PLAYERS_TABLE" (pName, pPw) VALUES ('%s', '%s')", getPlayerName(pid), pw),
QUERY_NONE // none naudoti, kada reikia palaukti kol duomenys bus įraљyti į mysql
);
setPlayerSqlID(pid, sql_insert_id(r));
set.fPrisijunge[pid] = true;
OnPlayerRegister(pid);
}
} else {
Kick(pid);
}
}
showDialog(pid, using inline register, DIALOG_STYLE_INPUT, "{FFC13B}•{ffffff} REGISTRACIJA", "Įvesk naują slaptaћodį:", "Jungtis", "");
}
YCMD:pirkti(playerid, params[], help)
{
if(playerCar1 [ playerid ] != -1) return SendError(playerid, "jūs jau turite transportą !");
printf("lol1");
if( vehSelected[ playerid ] == sportCars - 1 ) return 0;
printf("lol2");
if( soldCars[ vehSelected [ playerid ] ][ soldPrice ] > getPlayerMoney( playerid ) ) return SendError( playerid, "Neuћtenka pinigų transportui!" ) ;
givePlayerMoney(playerid, -soldCars[ vehSelected [ playerid ] ][ soldPrice ]);
printf("lol3");
playerCar1 [ playerid ] = CreateVehicle ( soldCars[ vehSelected[ playerid ]][ soldModel ], -1979.8074,270.1521, 90,0000, ChosenColor[playerid], ChosenColor[playerid], -1 ) ;
format ( masina [ playerCar1 [ playerid ] ] [ vehOwner ] , 50 , "%s" , getPlayerName ( playerid ) ) ;
for ( new tune = 0; tune < 13; tune++ ) masina [ playerCar1 [ playerid ] ] [ vehTune ] [ tune ] = 0;
for ( new color = 0; color < 2; color++ ) masina [ playerCar1 [ playerid ] ] [ vehColor ] [ color ] = ChosenColor[playerid];
masina [ playerCar1 [ playerid ] ] [ vehPaintjob ] = -1;
masina [ playerCar1 [ playerid ] ] [ lock ] = true;
masina [ playerCar1 [ playerid ] ] [ vehRida ] = 0.0;
masina [ playerCar1 [ playerid ] ] [ Gas ] = 40;
masina [ playerCar1 [ playerid ] ] [ vehLastPos ] [ 0 ] = -1979.8074;
masina [ playerCar1 [ playerid ] ] [ vehLastPos ] [ 1 ] = 270.1521 ;
masina [ playerCar1 [ playerid ] ] [ vehLastPos ] [ 2 ] = 35.0415 ;
masina [ playerCar1 [ playerid ] ] [ vehLastPos ] [ 3 ] = 90.0000 ;
masina [ playerCar1 [ playerid ] ] [ vehModel ] = soldCars[ vehSelected[ playerid ]][ soldModel ];
masina [ playerCar1 [ playerid ] ] [ vehOwned ] = true;
SetVehicleParamsEx ( playerCar1 [ playerid ], false, false, false, false, false, false, false ) ;
new query [ 200 ];
format ( query , sizeof ( query ) , "NEREGISTRUOTA") ;
SetVehicleNumberPlate ( playerCar1 [ playerid ] , query) ;
format ( masina [ playerCar1 [ playerid ] ] [ vehNumber ] , 21 , "%s" , query ) ;
format(g_szBuffer, sizeof g_szBuffer,
"INSERT INTO "MySQL_VEHICLE_TABLE" \
\
(savininkas, \
modelis, \
posX, \
posY, \
posZ, \
posA, \
spalva1, \
spalva2, \
kaina, \
degalai, \
numeriai) \
\
VALUES \
('%s', '%i', '%f', '%f', '%f', '%f', '%i', '%i', '%i', '%f', '%s')", \
masina[ playerCar1 [ playerid ] ][ vehOwner ],
masina[ playerCar1 [ playerid ] ][ vehModel ],
masina[ playerCar1 [ playerid ] ][ vehLastPos ][0],
masina[ playerCar1 [ playerid ] ][ vehLastPos ][1],
masina[ playerCar1 [ playerid ] ][ vehLastPos ][2],
masina[ playerCar1 [ playerid ] ][ vehLastPos ][3],
ChosenColor[playerid],
ChosenColor[playerid],
masina[ playerCar1 [ playerid ] ][ vehKaina ],
masina[ playerCar1 [ playerid ] ][ Gas ],
masina[ playerCar1 [ playerid ] ][ vehNumber ]);
sql_query(sql, g_szBuffer, QUERY_THREADED);
format ( query , sizeof ( query ) , "Nusipirkote transportą ( {f86000}%s{ffffff} ), kurio numeriai ( {f86000}%s{ffffff} ) !" , aVehicleNames [ masina [ playerCar1 [ playerid ] ] [ vehModel ] - 400 ], masina[playerCar1[playerid]][vehNumber] ) ;
SendClientMessage(playerid,-1,query);
CancelSelectTextDraw(playerid);
SetPlayerVirtualWorld(playerid, 0);
//SendClientMessage(playerid, 0xFFFFFFAA, "isejai is car shopo :).");
hideCarShop(playerid);
DestroyVehicle( preVeh[ playerid ] ) ;
SetCameraBehindPlayer( playerid );
TogglePlayerControllable( playerid, 1 ) ;
return 1;
}