Wo liegt da jz der fehler?
Beiträge von RickFace
-
-
Hallo liebe community,
ich habe folgendes problem...
ich habe einen Timer eingebaut der alle 10 sekunden die "Components" in enum Variablem Speichert und anschließend in eine MySQL Datenbank Speichert
irgendwie speichert er zwar die enum Variablen aber nicht die MySQL DatenbankHier mal der PAWN-Code:
SetTimer("CarSaveTuning",1000*10,1);
public CarSaveTuning()
{
for(new i=0; i<sizeof(vInfo); i++)
{
if(vInfo[i][v_id_x]==0)continue;
new id_x = vInfo[i][v_id_x];
new color1,color2;
GetVehicleColor(id_x, color1,color2);
vInfo[i][v_Color1]=color1;
vInfo[id_x][v_Color2]=color2;
vInfo[id_x][v_spoiler]=GetVehicleComponentInSlot(id_x,0);
vInfo[id_x][v_hood]=GetVehicleComponentInSlot(id_x,1);
vInfo[id_x][v_roof]=GetVehicleComponentInSlot(id_x,2);
vInfo[id_x][v_sideskirt]=GetVehicleComponentInSlot(id_x,3);
vInfo[id_x][v_lamps]=GetVehicleComponentInSlot(id_x,4);
vInfo[id_x][v_nitro]=GetVehicleComponentInSlot(id_x,5);
vInfo[id_x][v_exhaust]=GetVehicleComponentInSlot(id_x,6);
vInfo[id_x][v_wheels]=GetVehicleComponentInSlot(id_x,7);
vInfo[id_x][v_stereo]=GetVehicleComponentInSlot(id_x,8);
vInfo[id_x][v_hydraulics]=GetVehicleComponentInSlot(id_x,9);
vInfo[id_x][v_front_bumper]=GetVehicleComponentInSlot(id_x,10);
vInfo[id_x][v_rear_bumper]=GetVehicleComponentInSlot(id_x,11);
vInfo[id_x][v_vent_left]=GetVehicleComponentInSlot(id_x,12);
vInfo[id_x][v_vent_right]=GetVehicleComponentInSlot(id_x,13);
new query[164];
format(query,sizeof(query),"SELECT * FROM autos WHERE nummer='%i'",vInfo[id_x][v_nummer]);
mysql_function_query(dbhandle,query,true,"OnCarsSaved","i",id_x);
}
return 1;
}public OnCarsSaved(vehicleid)
{
new num_rows, num_fields;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)
{
new query[164];
format(query,sizeof(query),"INSERT INTO autos (x,y,z,r,paintjob,Color1,Color2,Spoiler,Hood,Roof,Sideskirt) VALUES('%f','%f','%f','%f','%i','%i','%i','%i','%i')",vInfo[vehicleid][v_x],vInfo[vehicleid][v_y],vInfo[vehicleid][v_z],vInfo[vehicleid][v_r],vInfo[vehicleid][v_paintjob],vInfo[vehicleid][v_Color1],vInfo[vehicleid][v_Color2],vInfo[vehicleid][v_spoiler],vInfo[vehicleid][v_hood],vInfo[vehicleid][v_roof],vInfo[vehicleid][v_sideskirt]);
mysql_function_query(dbhandle,query,false,"","");
format(query,sizeof(query),"INSERT INTO autos (Lamps,Nitro,Exhaust,Wheels,Stereo,Hydraulics,Front_Bumper,Rear_Bumper,Vent_Left,Vent_Right) VALUES ('%i','%i','%i','%i','%i','%i','%i','%i','%i','%i')",vInfo[vehicleid][v_lamps],vInfo[vehicleid][v_nitro],vInfo[vehicleid][v_exhaust],vInfo[vehicleid][v_wheels],vInfo[vehicleid][v_stereo],vInfo[vehicleid][v_hydraulics],vInfo[vehicleid][v_front_bumper],vInfo[vehicleid][v_rear_bumper],vInfo[vehicleid][v_vent_left],vInfo[vehicleid][v_vent_right]);
mysql_function_query(dbhandle,query,false,"","");
}
else
{
new query[200];
format(query,sizeof(query),"UPDATE autos x='%f',y='%f',z='%f',r='%f',paintjob='%i',Color1='%i' WHERE id='%i'",vInfo[vehicleid][v_x],vInfo[vehicleid][v_y],vInfo[vehicleid][v_z],vInfo[vehicleid][v_r],vInfo[vehicleid][v_paintjob],vInfo[vehicleid][v_Color1],vInfo[vehicleid][v_Color2], vInfo[vehicleid][v_db_id]);
mysql_function_query(dbhandle,query,false,"","");
format(query,sizeof(query),"UPDATE autos Color2='%i',Spoiler='%i',Hood='%i',Roof='%i',Sideskirt='%i' WHERE id='%i'",vInfo[vehicleid][v_Color1],vInfo[vehicleid][v_spoiler],vInfo[vehicleid][v_hood],vInfo[vehicleid][v_roof],vInfo[vehicleid][v_sideskirt],vInfo[vehicleid][v_db_id]);
mysql_function_query(dbhandle,query,false,"","");
format(query,sizeof(query),"UPDATE autos Lamps='%i',Nitro='%i',Exhaust='%i',Wheels='%i',Stereo='%i' WHERE id='%i'",vInfo[vehicleid][v_lamps],vInfo[vehicleid][v_nitro],vInfo[vehicleid][v_exhaust],vInfo[vehicleid][v_wheels],vInfo[vehicleid][v_stereo],vInfo[vehicleid][v_db_id]);
mysql_function_query(dbhandle,query,false,"","");
format(query,sizeof(query),"UPDATE autos Hydraulics='%i',Front_Bumper='%i',Rear_Bumper='%i',Vent_Left='%i',Vent_Right='%i' WHERE id='%i'",vInfo[vehicleid][v_hydraulics],vInfo[vehicleid][v_front_bumper],vInfo[vehicleid][v_rear_bumper],vInfo[vehicleid][v_vent_left],vInfo[vehicleid][v_vent_right],vInfo[vehicleid][v_db_id]);
mysql_function_query(dbhandle,query,false,"","");
}
}Schonmal Danke im vorraus für eure hilfe
-
Hallo liebe com,
ich brauche dringend hilfe...
ich habe unter OnGameModeInit eingegeben das ein Bot connecten und einen Timer rein gemacht das er mich verfolgt wenn ich in der nähe bin...
funkt auch alles aber sobalt ich dann auf den server komme stürzt er ab
Weiß vllt einer warum???
OnGameModeInit
new tmp[128];
tmp="test";
new npc = ConnectRNPC(tmp);
SetPVarString(npc, "NPCNAME", tmp);
SetPVarInt(npc, "NPCID", npc);
new string[128];
format(string,sizeof(string), "Bot wurde verbunden. (ID: %d | Name: %s)", npc, tmp);
print(string);
[b]DER TIMER[/b]
public zombietimer1(playerid)
{
new Float:x, Float:y, Float:z;
if(GetPVarInt(playerid, "AufVerfolgung")==1)
{
GetPlayerPos(GetPVarInt(playerid, "VerfolgterSpieler"),x,y,z);
if(IsPlayerInRangeOfPoint(playerid, 20.0, x,y,z))
{
ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1,1);
MoveRNPC(playerid, x,y,z, 0.040);
}
else
{
SetPVarInt(playerid, "AufVerfolgung", 0);
}
}
else
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerNPC(i)==0)
{
GetPlayerPos(i, x,y,z);
if(IsPlayerInRangeOfPoint(playerid, 20.0, x,y,z))
{
SetPVarInt(playerid, "AufVerfolgung", 1);
SetPVarInt(playerid, "VerfolgterSpieler", i);
ApplyAnimation(playerid,"PED","WALK_DRUNK",4.1,1,1,1,1,1,1);
MoveRNPC(playerid, x,y,z, 0.004);break;
}
}}
}
return;
}