Hallo ich arbeite daran, das ich Autos erstellen und laden kann.
saveCarToDB(playerid,carid)
{
new query[128];
format(query,sizeof(query),"INSERT INTO userautos (besitzer,model,x,y,z,r) VALUES ('%i','%i','%f','%f','%f','%f')",sInfo[playerid][id],cInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r]);
mysql_function_query(dbhandle,query,true,"carSavedToDB","i",carid);
return 1;
}
createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r)
{
for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][id_x]!=0)continue;
GetPlayerName(playerid,cInfo[i][besitzer],MAX_PLAYER_NAME);
cInfo[i][c_x]=x;
cInfo[i][c_y]=y;
cInfo[i][c_z]=z;
cInfo[i][c_r]=r;
cInfo[i][model]=modelid;
cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
new string[128];
format(string,sizeof(string),"cInfo[%i] ist erstellt",i);
SendClientMessageToAll(COLOR_RED,string);
saveCarToDB(playerid,i);
return 1;
}
return 1;
}
ocmd:pveh(playerid,params[])
{
new mID,pID;
if(sscanf(params,"ui",pID,mID))return SendClientMessage(playerid,COLOR_RED,"INFO: /pveh [playerid] [model]");
if(mID<400||mID>611)return SendClientMessage(playerid,COLOR_RED,"Ungültiges Model.");
new Float:xc,Float:yc,Float:zc,Float:rc;
GetPlayerPos(pID,xc,yc,zc);
GetPlayerFacingAngle(pID,rc);
createPlayerCar(pID,mID,xc,yc,zc,rc);
return 1;
}
Wie geh ich jetzt hin, das wenn der Server startet, alle Autos geladen werden?