MySQL tquery

Započeo toncikica, Mart 09, 2024, 17:55:44 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Pitanje vezano za mysql, pokusavao sam izvuci iz ultimate mastera od sace i ghetovena i sa starom bj moda, al mi ne uspijeva. Ne znam kako da sacuvam igraca( SavePlayer( id )) kad je offline, npr. komanda offjail, kako da kad admin ukuca ingame igraca, da mu offline seta vrijeme i razlog itd... Ako ima neko prijedlog, bio bih zahvalan !

Posalji nam cmd jaila pa da ti pokazem primjer mysql querya zw to.
69

Citat: youngdeal poslato Mart 09, 2024, 19:50:28 POSLE PODNE
Posalji nam cmd jaila pa da ti pokazem primjer mysql querya zw to.
[pawn]CMD:jail( playerid, params[])
{
   if( PI[ playerid ][ Admin ] == 0 ) return GRESKA( playerid, "Niste ovlasteni !");
   else if( PI[ playerid ][ Admin ] >= 1 && PI[ playerid ][ Admin ] < 7 )
   {
      new id, time, razlog[ 48 ], name[ MAX_PLAYER_NAME ], datum[ 48 ], dan, mjesec, godina, sat, minuta, sekunda;
      gettime( sat, minuta, sekunda );
      getdate( godina, mjesec, dan );
      format( datum, sizeof( datum ), "%02d/%02d/%d u %02d:%02d:%02d", dan, mjesec, godina, sat, minuta, sekunda );
      GetPlayerName( playerid, name, sizeof( name ));
      if( sscanf( params, "uds[48]", id, time, razlog ))
      {
         KORISCENJE( playerid, "/jail [Ime_Prezime/ID] [Vrijeme] [Razlog]");
         INFO( playerid, "Vrijeme unesite u formatu 'Minuta'(60 Minuta = 1 Sat) !");
         INFO( playerid, "Jail Listu mozete vidjeti sljedecom komadnom ~ /jaillista");
         return 1;
      }
      if( !IsPlayerConnected( id )) return GRESKA( playerid, "Igrac nije konektovan ! ~ /offjail");
      if( id == playerid ) return GRESKA( playerid, "Ne mozes sam sebe majmune !");
      if( PI[ id ][ Admin ] >= 1 ) return GRESKA( playerid, "Igrac je Admin !");
      if( PI[ id ][ Jail ] >= 1 ) return GRESKA( playerid, "Igrac je vec u Jailu !");
      {
         new msg[ 512 ], amsg[ 256 ];
         PI[ id ][ Jail ] = time;
         strmid( PI[ id ][ JailR ], razlog, 0, strlen( razlog ), 48 );
         strmid( PI[ id ][ JailA ], name, 0, strlen( name ), MAX_PLAYER_NAME );
         SetTimerEx( "JailTimer", 60000, true, "i", id );
         SavePlayer( id );
         AdminInfo[ playerid ][ aJail ] ++; SaveAdmin( playerid );
         new rand = random( sizeof( RandomJail ));
         SetPlayerSkin( id, 252 );
         SetPlayerPos( playerid, RandomJail[ rand ][ 0 ], RandomJail[ rand ][ 1 ], RandomJail[ rand ][ 2 ]);
         SetPlayerWorldBounds( playerid, 285.2582, 97.0161, 1940.9780, 1799.1313 );

         format( msg, sizeof( msg ), "Postovani %s,\n%s %s Vas je Jail-ovao !\n>KAZNA: %d Minuta.\n>RAZLOG: %s.\nDatum i Vrijeme: %s.\nUkoliko mislite da ste Jail-ovani greskom ili nekorektno Jail-ovani, obratite nam se na Forumu: "FORUM"", GetName( id ), GetARank( playerid ), GetName( playerid ), time, razlog, datum );
         SPD( id, DIALOG_PROMOTE, DSMSGB, D_NASLOV, msg, D_OK, "");
         format( amsg, sizeof( amsg ), "{FF0000}#JAIL | {FFFFFF}%s %s je Jail-ovao igraca %s na %d Minuta ! Razlog: %s.", GetARank( playerid ), GetName( playerid ), GetName( id ), time, razlog );
         GlobalPoruka( COLOR_RED, amsg );
         LogSave( "Ostalo/Logs/LogJail.log", amsg );
      }
   }
   else if( PI[ playerid ][ Admin ] >= 7 )
   {
      new id, time, razlog[ 48 ], name[ MAX_PLAYER_NAME ], datum[ 48 ], dan, mjesec, godina, sat, minuta, sekunda;
      gettime( sat, minuta, sekunda );
      getdate( godina, mjesec, dan );
      format( datum, sizeof( datum ), "%02d/%02d/%d u %02d:%02d:%02d", dan, mjesec, godina, sat, minuta, sekunda );
      GetPlayerName( playerid, name, sizeof( name ));
      if( sscanf( params, "uds[48]", id, time, razlog ))
      {
         KORISCENJE( playerid, "/jail [Ime_Prezime/ID] [Vrijeme] [Razlog]");
         INFO( playerid, "Vrijeme unesite u formatu 'Minuta'(60 Minuta = 1 Sat) !");
         INFO( playerid, "Jail Listu mozete vidjeti sljedecom komadnom ~ /jaillista");
         return 1;
      }
      if( !IsPlayerConnected( id )) return GRESKA( playerid, "Igrac nije konektovan ! ~ /offjail");
      //if( id == playerid ) return GRESKA( playerid, "Ne mozes sam sebe majmune !");
      if( PI[ id ][ Jail ] >= 1 ) return GRESKA( playerid, "Igrac je vec u Jailu !");
      {
         new msg[ 512 ], amsg[ 256 ];
         PI[ id ][ Jail ] = time;
         strmid( PI[ id ][ JailR ], razlog, 0, sizeof( razlog ), 48 );
         strmid( PI[ id ][ JailA ], name, 0, sizeof( name ), MAX_PLAYER_NAME );
         SetTimerEx( "JailTimer", 60000, true, "i", id );
         SavePlayer( id );
         AdminInfo[ playerid ][ aJail ] ++; SaveAdmin( playerid );
         new rand = random( sizeof( RandomJail ));
         SetPlayerSkin( id, 252 );
         SetPlayerPos( playerid, RandomJail[ rand ][ 0 ], RandomJail[ rand ][ 1 ], RandomJail[ rand ][ 2 ]);
         SetPlayerWorldBounds( playerid, 285.2582, 97.0161, 1940.9780, 1799.1313 );

         format( msg, sizeof( msg ), "Postovani %s,\n%s %s Vas je Jail-ovao !\n>KAZNA: %d Minuta.\n>RAZLOG: %s.\nDatum i Vrijeme: %s.\nUkoliko mislite da ste Jail-ovani greskom ili nekorektno Jail-ovani, obratite nam se na Forumu: "FORUM"", GetName( id ), GetARank( playerid ), GetName( playerid ), time, razlog, datum );
         SPD( id, DIALOG_PROMOTE, DSMSGB, D_NASLOV, msg, D_OK, "");
         format( amsg, sizeof( amsg ), "{FF0000}#JAIL | {FFFFFF}%s %s je Jail-ovao igraca %s na %d Minuta ! Razlog: %s.", GetARank( playerid ), GetName( playerid ), GetName( id ), time, razlog );
         GlobalPoruka( COLOR_RED, amsg );
         LogSave( "Ostalo/Logs/LogJail.log", amsg );
      }
   }
   return true;
}[/pawn]

[pawn]
UPDATE `Users` SET `Jailed` = 1, `JailTime` = 300 WHERE `UserName` = 'Nesto'
[/pawn]
Nesto tipa toga, ti prilagodi sam...