Guten Nabend liebe Leute,
ich habe das Problem, dass wenn ein Spieler "geprisoned" wurde und reloggt nicht mehr ins Prison zurück teleportiert wird.
Ich habe nur den Error dass das Feld nicht gefunden/gelesen werden konnte. Warum weiß icht nicht.
Befehl und Timer funktionieren nur nicht, dass es beim Login ausgelesen wird.
public OnPasswordResponse(playerid)
{
new num_fields, num_rows;
new str[256];
cache_get_data(num_rows, num_fields);
if(num_rows == 0)
{
if(SpielerInfo[playerid][pLoginTry] == 0)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 1 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 1)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 2 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 2)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 3 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 3)
{
SendClientMessage(playerid,Rot,"Error: {FFFFFF}The entered password was to often wrong. You have been kicked.");
SetTimerEx("KickTimer",500,false,"i",playerid);
SpielerInfo[playerid][pLoginTry] = 0;
return 1;
}
}
else
{
LoadAccount(playerid);
SpawnPlayerEx(playerid);
if(IsPlayerAnAdmin(playerid))
SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You are an Admin.");
}
return 1;
}
new str[256];
cache_get_data(num_rows, num_fields);
if(num_rows == 0)
{
if(SpielerInfo[playerid][pLoginTry] == 0)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 1 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 1)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 2 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 2)
{
SendClientMessage(playerid,Rot, "Error: {FFFFFF}The entered password is wrong. | Try 3 of 3");
format(str,sizeof(str),"{FFFFFF}Welcome back {FF7800}%s!\n\n{FFFFFF}A account under this name is already registered in the Server Database.\nIf this not your Account, please take a different Name to play on this Server.\nPlease enter your password:",getPlayerName(playerid));
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{FF7800}TRP - Login",str,"Login","Cancel");
SpielerInfo[playerid][pLoginTry] ++;
return 1;
}
if(SpielerInfo[playerid][pLoginTry] == 3)
{
SendClientMessage(playerid,Rot,"Error: {FFFFFF}The entered password was to often wrong. You have been kicked.");
SetTimerEx("KickTimer",500,false,"i",playerid);
SpielerInfo[playerid][pLoginTry] = 0;
return 1;
}
}
else
{
LoadAccount(playerid);
SpawnPlayerEx(playerid);
if(IsPlayerAnAdmin(playerid))
SendClientMessage(playerid,Gelb,"[SInfo] {FFFFFF}You are an Admin.");
}
return 1;
}
stock LoadAccount(playerid)
{
SpielerInfo[playerid][pEingeloggt] = true;
SpielerInfo[playerid][pGeld] = cache_get_field_content_int(0,"Geld",Handle),GivePlayerMoney(playerid,SpielerInfo[playerid][pGeld]);
SpielerInfo[playerid][pKonto] = cache_get_field_content_int(0,"KontoMoney",Handle);
SpielerInfo[playerid][pLevel] = cache_get_field_content_int(0,"Level",Handle),SetPlayerScore(playerid,SpielerInfo[playerid][pLevel]);
SpielerInfo[playerid][pALevel] = cache_get_field_content_int(0,"ALevel",Handle);
SpielerInfo[playerid][pSkin] = cache_get_field_content_int(0,"Skin",Handle);
SpielerInfo[playerid][pFrak] = cache_get_field_content_int(0,"Fraktion",Handle);
SpielerInfo[playerid][pOwnHouse] = cache_get_field_content_int(0,"OwnHouse",Handle);
SpielerInfo[playerid][pHouseID] = cache_get_field_content_int(0,"HouseID",Handle);
SpielerInfo[playerid][pEingemietet] = cache_get_field_content_int(0,"Eingemietet",Handle);
SpielerInfo[playerid][pPrisoned] = cache_get_field_content_int(0,"IsPrisoned",Handle);
if(SpielerInfo[playerid][pEingemietet] == 1)
{
SpielerInfo[playerid][pHouseID] = cache_get_field_content_int(0,"houseID",Handle);
SpielerInfo[playerid][pRenterID] = cache_get_field_content_int(0,"renterID",Handle);
}
if(SpielerInfo[playerid][pPrisoned] == 1)
{
SpielerInfo[playerid][pPrisonedBis] = cache_get_field_content_int(0,"PrisonedBis",Handle);
ClearChatForPlayer(playerid);
PrisonSpawn(playerid);
}
ClearChatForPlayer(playerid);
SetTimerEx("PlayerUpdate",60000,true,"i",playerid);
SetPlayerColor(playerid,Weiß);
return 1;
}
Bild der Datenbank:
public PrisonTimer(playerid)
{
if(SpielerInfo[playerid][pPrisonedBis] <= gettime())
{
SpielerInfo[playerid][pPrisoned] = 0;
SpielerInfo[playerid][pPrisonedBis] = 0;
format(SpielerInfo[playerid][pPrisonReason],64,"");
KillTimer(SpielerInfo[playerid][pTimerID]);
new query[256];
format(query,sizeof(query),"DELETE FROM prisoneduser WHERE username='%s'",getPlayerName(playerid));
mysql_pquery(Handle,query);
SpawnPlayerEx(playerid);
SendClientMessage(playerid,Rot,"Unbanned");
}
return 1;
}
ocmd:prison(playerid,params[])
{
if(!IsPlayerOnline(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}You are not logged in.");
if(!IsPlayerAnAdmin(playerid))return SendClientMessage(playerid,Rot,"Error: {FFFFFF]You are not allowed to use this Command.");
new query[256];
new pID,reason[64],str[144];
new Minute;
if(sscanf(params,"uis",pID,Minute,reason))return SendClientMessage(playerid,Rot,"Error: {FFFFFF}Use /prison [Playerid] [Minutes] [Reason]");
if(pID == INVALID_PLAYER_ID)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This Player isn't Online.");
if(SpielerInfo[pID][pEingeloggt] != 1)return SendClientMessage(playerid,Rot,"Error: {FFFFFF}This Player isn't Online");
format(str,sizeof(str),"[Info] {FFFFFF}%s has been teleported to the prison for %i Minutes by %s. Reason: %s",getPlayerName(pID),Minute,getPlayerName(playerid),reason);
SendClientMessageToAll(Rot,str);
format(query,sizeof(query),"INSERT INTO prisoneduser (username,IsPrisoned,PrisonedBis,PrisonReason,PrisonAdmin) VALUES ('%s','1','%i','%s','%s')",
getPlayerName(pID),gettime()+Minute*60,reason,getPlayerName(playerid));
mysql_pquery(Handle,query);
SetPlayerPos(pID,726.7279,1440.4874,1102.7031);
SetPlayerInterior(pID,6);
SpielerInfo[playerid][pTimerID] = SetTimerEx("PrisonTimer",60000,true,"i",pID);
SpielerInfo[pID][pPrisoned] = 1;
SpielerInfo[pID][pPrisonedBis] = gettime()+Minute*60;
printf("%i",SpielerInfo[pID][pPrisonedBis]);
format(SpielerInfo[pID][pPrisonReason],64,"%s",reason);
return 1;
}
Schonmal danke im Voraus.
//EDIT:
Fehler im MySQL-Log: