ocmd:createfcar(playerid,params[])
{
if(!isAdmin(playerid,1)) return print("createfcar ADMIN FAILED");// ADuty[playerid] == 1) return SendClientMessage(playerid,-1,"Nicht Duty oder Admin");
//new query[128];
new mID,color1,color2,frakid,Float:pos[4];//,frakt[128];
print("Car fehlgeschlagen 2");
if(sscanf(params,"iiiu",mID,color1,color2,frakid)) return SendClientMessage(playerid,-1,"INFO: /createfcar [VehicleID] [Color1] [Color2] [Fraktionsname]");
if(mID <400 mID > 611) return SendClientMessage(playerid,RED,"Ungültige ID!");
{
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
//SetPVarString(pID,"Frakt",frakt);
GetPlayerFacingAngle(playerid,pos[3]);
createFrakCar(playerid,mID,pos[0],pos[1],pos[2],pos[3],color1,color2,frakid);
print("Car erfolgreich");
}
print("Car fehlgeschlagen");
return 1;
}
forward frakcarSavedToDB(carid);
createFrakCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r,color1,color2,frak){
print("Createfcar vor schleife");
for(new i=0; i<sizeof(fInfo); i++){
print("Create fcar in schleif");
//if(fInfo[i][id_x]!=0)continue;
//cInfo[i][besitzer]=fInfo[playerid][f_name];
//GetPlayerName(playerid,cInfo[i][besitzer],MAX_PLAYER_NAME);
fInfo[i][f_x]=x;
fInfo[i][f_y]=y;
print("createfrakcar mitte");
fInfo[i][f_z]=z;
fInfo[i][f_r]=r;
fInfo[i][f_c1] = color1;
fInfo[i][f_c2] = color2;
fInfo[i][fid] = frak;
fInfo[i][model]=modelid;
fInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,color1,color2,-1);
new string[144],pIDname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pIDname,sizeof(pIDname));
format(string,sizeof(string),"Das Auto NR[%i] wurde für %s erstellt",i,pIDname);
SendClientMessageToAll(RED,string);
saveFrakCarToDB(fInfo[i][id_x]);
print("Createfcar in schleife ende");
return 1;
}
return 1;
}
saveFrakCarToDB(carid)
{
new query[512];
print("saveFraktoDb vorher");
format(query,sizeof(query),"INSERT INTO Frakcars(Fraktion,ModelID,Farbe1,Farbe2,PosX,PosY,PosZ,PosR,Frakid) VALUES ('%s','%i','%i','%i','%f','%f','%f','%f','%i')",fInfo[carid][f_name],fInfo[carid][model],fInfo[carid][f_c1],fInfo[carid][f_c2],fInfo[carid][f_x],fInfo[carid][f_y],fInfo[carid][f_z],fInfo[carid][f_r],fInfo[carid][fid]);
print(query); // <--- diese Zeile
mysql_function_query(dbhandle,query,true,"","");
print("saveFraktoDb nachher");
return 1;
}
hoffe das ist das wichtigste