Speichern in meiner MySQL datenbank
Auslesen bei OnGameModeInit aus der Datenbank
Setzen auch bei OGMI
Die Position wird auch richtig eingeschrieben, nur der Spawn failt...
Beiträge von PatoD
-
-
Ich spawne den Spieler halt durch das Laden per MySQL.
Also beim Dynamischen Fraktionssystem.
Nur irgenwie muss ich den Spawn beim Login immer neu festlegen, obwohl in der Datenbank die richtige Position steht. -
Das passiert wenn ich einen Spieler spawnen will (Dyn. Fraktsystem):
Weiß einer warum das passiert und wie man das entbuggen kann?
-
#define ACCLADEN sscanf(savedata,"p<|>e<"Deine Variablen">","Dein Enum");
-
-
DANKEEEE :)))
ES KLAPPT ENDLICH WIEDER :)))) -
Hallo Community,
ich habe das Problem das ich mir ein Einarmiger Bandit Script gescriptet habe, aber es nicht klappen will.Er zeigt mir anstatt die Bilder nur den Namen der Bilder also z.b. "LD_SLOT:berry" oder so an...
new bool:OAB_ON[MAX_PLAYERS];
new PlayerText:OAB_TD_1[MAX_PLAYERS];
new PlayerText:OAB_TD_2[MAX_PLAYERS];
new PlayerText:OAB_TD_3[MAX_PLAYERS];
new PlayerText:OAB_TD_4[MAX_PLAYERS];
new PlayerText:OAB_TD_5[MAX_PLAYERS];
new PlayerText:OAB_TD_6[MAX_PLAYERS];
new PlayerText:OAB_TD_7[MAX_PLAYERS];
new PlayerText:OAB_TD_8[MAX_PLAYERS];
new PlayerText:OAB_TD_9[MAX_PLAYERS];
new OAB_TD_1_SLOT[MAX_PLAYERS];
new OAB_TD_2_SLOT[MAX_PLAYERS];
new OAB_TD_3_SLOT[MAX_PLAYERS];
new OAB_TD_4_SLOT[MAX_PLAYERS];
new OAB_TD_5_SLOT[MAX_PLAYERS];
new OAB_TD_6_SLOT[MAX_PLAYERS];
new OAB_TD_7_SLOT[MAX_PLAYERS];
new OAB_TD_8_SLOT[MAX_PLAYERS];
new OAB_TD_9_SLOT[MAX_PLAYERS];
new OAB_TICKS[MAX_PLAYERS];public OnPlayerConnect(playerid)
{
OAB_TD_1[playerid] = CreatePlayerTextDraw(playerid,274,247,"LD_SLOT:r_69");
OAB_TD_2[playerid] = CreatePlayerTextDraw(playerid,200,247,"LD_SLOT:r_69");
OAB_TD_3[playerid] = CreatePlayerTextDraw(playerid,348,247,"LD_SLOT:r_69");
OAB_TD_4[playerid] = CreatePlayerTextDraw(playerid,274,300,"LD_SLOT:r_69");
OAB_TD_5[playerid] = CreatePlayerTextDraw(playerid,200,300,"LD_SLOT:r_69");
OAB_TD_6[playerid] = CreatePlayerTextDraw(playerid,348,300,"LD_SLOT:r_69");
OAB_TD_7[playerid] = CreatePlayerTextDraw(playerid,274,353,"LD_SLOT:r_69");
OAB_TD_8[playerid] = CreatePlayerTextDraw(playerid,200,353,"LD_SLOT:r_69");
OAB_TD_9[playerid] = CreatePlayerTextDraw(playerid,348,353,"LD_SLOT:r_69");
...
forward OneArmedBanditTick(playerid);
public OneArmedBanditTick(playerid)
{
new timertime;
OAB_TD_1_SLOT[playerid]=VarRandom(1,6);
OAB_TD_2_SLOT[playerid]=VarRandom(1,6);
OAB_TD_3_SLOT[playerid]=VarRandom(1,6);
OAB_TD_4_SLOT[playerid]=VarRandom(1,6);
OAB_TD_5_SLOT[playerid]=VarRandom(1,6);
OAB_TD_6_SLOT[playerid]=VarRandom(1,6);
OAB_TD_7_SLOT[playerid]=VarRandom(1,6);
OAB_TD_8_SLOT[playerid]=VarRandom(1,6);
OAB_TD_9_SLOT[playerid]=VarRandom(1,6);
PlayerTextDrawSetString(playerid,OAB_TD_1[playerid],OABGetTDText(OAB_TD_1_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_2[playerid],OABGetTDText(OAB_TD_2_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_3[playerid],OABGetTDText(OAB_TD_3_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_4[playerid],OABGetTDText(OAB_TD_4_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_5[playerid],OABGetTDText(OAB_TD_5_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_6[playerid],OABGetTDText(OAB_TD_6_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_7[playerid],OABGetTDText(OAB_TD_7_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_8[playerid],OABGetTDText(OAB_TD_8_SLOT[playerid]));
PlayerTextDrawSetString(playerid,OAB_TD_9[playerid],OABGetTDText(OAB_TD_9_SLOT[playerid]));
switch (OAB_TICKS[playerid])
{
case 50..100:{timertime=50;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 40..49:{timertime=75;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 30..39:{timertime=100;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 20..29:{timertime=120;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 10..19:{timertime=150;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 9:{timertime=160;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 8:{timertime=170;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 7:{timertime=180;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 6:{timertime=190;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 5:{timertime=200;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 4:{timertime=210;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 3:{timertime=230;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 2:{timertime=260;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 1:{timertime=300;OAB_TICKS[playerid]--;SetTimerEx("OneArmedBanditTick",timertime,false,"u",playerid);}
case 0:{OAB_FINAL(playerid);}
}
return 1;
}forward OAB_END(playerid);
public OAB_END(playerid)
{
PlayerTextDrawHide(playerid,OAB_TD_1[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_2[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_3[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_4[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_5[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_6[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_7[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_8[playerid]);
PlayerTextDrawHide(playerid,OAB_TD_9[playerid]);
OAB_ON[playerid]=false;
TogglePlayerControllable(playerid,1);
return 1;
}stock OAB_WIN_ART(playerid)
{
if(OAB_TD_1_SLOT[playerid]==OAB_TD_2_SLOT[playerid] && OAB_TD_1_SLOT[playerid]==OAB_TD_3_SLOT[playerid] && OAB_TD_2_SLOT[playerid]==OAB_TD_3_SLOT[playerid])
{
if(OAB_TD_4_SLOT[playerid]==OAB_TD_5_SLOT[playerid] && OAB_TD_4_SLOT[playerid]==OAB_TD_6_SLOT[playerid] && OAB_TD_5_SLOT[playerid]==OAB_TD_6_SLOT[playerid])
{
if(OAB_TD_7_SLOT[playerid]==OAB_TD_8_SLOT[playerid] && OAB_TD_7_SLOT[playerid]==OAB_TD_9_SLOT[playerid] && OAB_TD_8_SLOT[playerid]==OAB_TD_9_SLOT[playerid])
{
return 3;
}
else
{
return 2;
}
}
else
{
return 1;
}
}
else if(OAB_TD_4_SLOT[playerid]==OAB_TD_5_SLOT[playerid] && OAB_TD_4_SLOT[playerid]==OAB_TD_6_SLOT[playerid] && OAB_TD_5_SLOT[playerid]==OAB_TD_6_SLOT[playerid])
{
if(OAB_TD_7_SLOT[playerid]==OAB_TD_8_SLOT[playerid] && OAB_TD_7_SLOT[playerid]==OAB_TD_9_SLOT[playerid] && OAB_TD_8_SLOT[playerid]==OAB_TD_9_SLOT[playerid])
{
return 2;
}
else
{
return 1;
}
}
else if(OAB_TD_7_SLOT[playerid]==OAB_TD_8_SLOT[playerid] && OAB_TD_7_SLOT[playerid]==OAB_TD_9_SLOT[playerid] && OAB_TD_8_SLOT[playerid]==OAB_TD_9_SLOT[playerid])
{
return 1;
}
else if(OAB_TD_1_SLOT[playerid]==OAB_TD_5_SLOT[playerid] && OAB_TD_1_SLOT[playerid]==OAB_TD_9_SLOT[playerid] && OAB_TD_5_SLOT[playerid]==OAB_TD_9_SLOT[playerid])
{
return 1;
}
return 0;
}stock OneArmedBanditStart(playerid)
{
if(OAB_ON[playerid]==true)return SendClientMessage(playerid,ROT,"Du kannst nicht spielen während ein Spiel läuft.");
TogglePlayerControllable(playerid,0);
OAB_ON[playerid]=true;
OAB_TICKS[playerid]=100;
PlayerTextDrawColor(playerid,OAB_TD_1[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_2[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_3[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_4[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_5[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_6[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_7[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_8[playerid],0xFFFFFFFF);
PlayerTextDrawColor(playerid,OAB_TD_9[playerid],0xFFFFFFFF);
PlayerTextDrawTextSize(playerid,OAB_TD_1[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_2[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_3[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_4[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_5[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_6[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_7[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_8[playerid],75,75);
PlayerTextDrawTextSize(playerid,OAB_TD_9[playerid],75,75);
PlayerTextDrawShow(playerid,OAB_TD_1[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_2[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_3[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_4[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_5[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_6[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_7[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_8[playerid]);
PlayerTextDrawShow(playerid,OAB_TD_9[playerid]);
SetTimerEx("OneArmedBanditTick",10,false,"u",playerid);
return 1;
}stock OAB_FINAL(playerid)
{
new menge,string[250];
if(OAB_WIN_ART(playerid) > 0)
{
menge = OAB_WIN_ART(playerid);
switch(OAB_TD_1_SLOT[playerid])
{
case 1:{format(string,sizeof(string),"~n~~r~!!!VEGAS!!!~n~~g~%d$",10000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,10000*menge);SendClientMessage(playerid,GRÜN,"Du bist in Vegas!!! Du hast 10.000$ gewonnen!!!");}
case 2:{format(string,sizeof(string),"~n~~r~!!!Gewonnen!!!~n~~g~%d$",5000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,5000*menge);SendClientMessage(playerid,GRÜN,"Du hast Gewonnen!!! Du hast 1.000$ gewonnen!!!");}
case 3:{format(string,sizeof(string),"~n~~r~!!!Gewonnen!!!~n~~g~%d$",1000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,1000*menge);SendClientMessage(playerid,GRÜN,"Du hast Gewonnen!!! Du hast 1.000$ gewonnen!!!");}
case 4:{format(string,sizeof(string),"~n~~r~!!!GOLDGLOCKE!!!~n~~g~%d$",50000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,50000*menge);SendClientMessage(playerid,GRÜN,"Hörst du die Goldglocken? Du hast 50.000$ gewonnen!!!");}
case 5:{format(string,sizeof(string),"~n~~r~!!!JACKPOT!!!~n~~g~%d$",500000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,500000*menge);SendClientMessage(playerid,GRÜN,"Du hast den Jackpot geknackt!!! Du hast 500.000$ gewonnen!!!");}
case 6:{format(string,sizeof(string),"~n~~r~!!!GOLDRAUSCH!!!~n~~g~%d$",100000*menge);GameTextForPlayer(playerid,string,10000,6);GivePlayerCash(playerid,100000*menge);SendClientMessage(playerid,GRÜN,"Du hast einen Goldrausch!!! Du hast 100.000$ gewonnen!!!");}
}
}
else
{
GameTextForPlayer(playerid,"~r~VERLOREN~n~~r~Diesmal hattest du Pech...",10000,6);
SendClientMessage(playerid,ROT,"Du hast Verloren... Vielleicht beim nächsten Mal.");
}
return SetTimerEx("OAB_END",5000,false,"u",playerid);
}Weiß einer vielleicht wo der Fehler liegt?
Ihr könnt es euch ja mal selbst rein machen und gucken was daran falsch ist -
Was hast du gebraucht? XD
-
Ich glaube er meint:
stock IsVehicleInRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z)
{
GetVehiclePos(vehicleid,x,y,z);
if((x < x+range && x > x+range) && (y < y+range && y > y+range) && (z < z+range && z > z+range))return 1;
return 0;
} //Ungetestetoder
stock IsPlayerInRangeOfVehicle(playerid,Float:range,vehicleid)
{
new Float:x,Float:y,Float:z;
GetVehiclePos(vehicleid,x,y,z);
if(IsPlayerInRangeOfPoint(playerid,range,x,y,z))return 1;
return 0;
} //Getestet und selbst bei mir drinne ^^ -
Mach dir nen Blankgamemode wo du die TD's etc. erstellst.
War bei mir auch so.
Jetzt klappt alles perfekt -
stock IsVehicleInRangeOfPoint(vehicleid,Float:range,Float:x,Float:y,Float:z)
{
GetVehiclePos(vehicleid,x,y,z);
if((x < x+range && x > x+range) && (y < y+range && y > y+range) && (z < z+range && z > z+range))return 1;
return 0;
} //Ungetestet -
Würde durch 100 besser sein?
-
-
ich würd aber nicht mit diesen mischungsbefehlen aus MySQL und Dini arbeiten, da es dir nicht immer helfen wird
-
Also es klappt aber...
Es ist SEHR langsam...
Kann mir einer den stock vielleicht machen das es besser klappt?
Ihr könnt ja mal testen einfach ein cmd machen und gucken wie langsam SetVehicleSpeed(veh,100); ist -
stock SetVehicleSpeed(vehicleid, Float:speed)
{
new Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2, Float:a;
GetVehicleVelocity(vehicleid, x1, y1, z1);
GetVehiclePos(vehicleid, x2, y2, z2);
GetVehicleZAngle(vehicleid, a); a = 360 - a;
x1 = (floatsin(a, degrees) * (speed/200) + floatcos(a, degrees) * 0 + x2) - x2;
y1 = (floatcos(a, degrees) * (speed/200) + floatsin(a, degrees) * 0 + y2) - y2;
SetVehicleVelocity(vehicleid, x1, y1, z1);
}Und wenn ja...
Es ist in mp/h und nicht km/h oder? -
Ich weiß es ist sehr alt aber...
Was macht der bei: SetVehicleSpeed
Macht der das in mph oder kmh ? -
Dann halt beim stock Login oder public oder was auch immer..
Da wo er sich einloggen soll und alles geladen wird am ende ein SpawnPlayer(playerid);
Dann müsste es gehen^^ -
public OnPlayerRequestClass(playerid, classid)
{
//new string[128],Name[MAX_PLAYER_NAME];
//GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
if(IsPlayerNPC(playerid))
{
SetSpawnInfo(playerid,0,26,-90.1402,-34.7737,3.1172,159.9182,0,0,0,0,0,0);
SpawnPlayer(playerid);
return 1;
}
else
{
/*=====[player sachen]=====*/
SetSpawnInfo(playerid,0,26,-90.1402,-34.7737,3.1172,159.9182,0,0,0,0,0,0);
TogglePlayerSpectating(playerid, 1);
for(new i;i!=60;i++) SendClientMessage(playerid,-1,"");
SendClientMessage(playerid,cYellow,"Herzlich Willkommen auf GTA - Centralstate Reloadet");
/*format(string,128,"SELECT * FROM `player` WHERE `Name` = '%s'",Name);
mysql_query(string);
mysql_store_result();
if(mysql_num_rows() == 1)
{
format(string,sizeof(string),"{FFFFFF}Der Account{FF6E00} %s {FFFFFF}wurde gefunden.\nUm sich einzuloggen gebe dein Passwort ein.",Name);
ShowPlayerDialog(playerid,diaLogin,DIALOG_STYLE_PASSWORD,"GTA - Centralstate",string,"Login","");
}
else
{
format(string,sizeof(string),"{FFFFFF}Der Account{FF6E00} %s {FFFFFF}wurde nicht gefunden.\nUm einen Account zu erstellen gebe dein Passwort ein.",Name);
ShowPlayerDialog(playerid,diaRegister,DIALOG_STYLE_INPUT,"GTA - Centralstate",string,"Register","");
}
mysql_free_result();*/ //Das kann alles schon bei OnPlayerConnect gemacht werden ;)
}
/*=========================*/
SpawnPlayer(playerid);
return 1;
} -
Und wie ist es wenn ich jetzt noch den Befehl /flock machen will?
Dann soll das Auto ja wieder für Alle auf sein..