Author Topic: Reset,Transfer, Inc And Dec Stats By ME (GUPS)  (Read 4721 times)

0 Members and 1 Guest are viewing this topic.

Offline mrockxkingbutt

  • Crime Boss
  • ****
  • Posts: 373
  • I AM Best Scripter And You Are Not :P
    • View Profile
Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« on: April 10, 2013, 07:59:23 am »
[pawn]   /// == RESET , == INCREASE, == DECREASE == OR == TRANSFER == STATS == CMDS ===
   else if ( strcmp( cmd, "resetstats", true ) == 0 )
   {
      tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_RED, "USAGE: /c resetstats [Nick/ID]" );
        else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
        else if ( !IsPlayerRegistered(gPlayers[ plr ] ) )
      {
         format( szMsg, sizeof( szMsg ), "Error: %s is not a registered nick.", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      else
      {
         format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
         dini_IntSet( file, "Deaths", 0 );
         dini_IntSet( file, "Kills", 0 );
         format( szMsg, sizeof( szMsg ), "%s's stats reseted.", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      return 1;
   }
      else if ( strcmp( cmd, "inckills", true ) == 0 )
   {
      tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_RED, "USAGE: /c inckills [Nick/ID]" );
        else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
        else if ( !IsPlayerRegistered(gPlayers[ plr ] ) )
      {
         format( szMsg, sizeof( szMsg ), "Error: %s is not a registered nick.", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      else
      {
         IncPlayerDeaths( plr, 0 );
         IncPlayerKills( plr, 1000 );
         format( szMsg, sizeof( szMsg ), "%s's stats Setted", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      return 1;
   }
         else if ( strcmp( cmd, "deckills", true ) == 0 )
   {
      tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_RED, "USAGE: /c deckills [Nick/ID]" );
        else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
        else if ( !IsPlayerRegistered(gPlayers[ plr ] ) )
      {
         format( szMsg, sizeof( szMsg ), "Error: %s is not a registered nick.", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      else
      {
         IncPlayerDeaths( plr, 1000 );
         IncPlayerKills( plr, 0 );
         format( szMsg, sizeof( szMsg ), "%s's stats Setted", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      return 1;
   }
      else if ( strcmp( cmd, "transferstats", true ) == 0 )
   {
   new plr2;
      tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      plr2 = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !IsAuthorized( playerid, cmd ) ) SendClientMessage( playerid, COLOR_RED, "You don't have access to use this command!" );
      else if ( !strlen( tmp ) ) SendClientMessage( playerid, COLOR_RED, "USAGE: /c transferstats [Nick/ID] [PLAYERID2]" );
        else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
        else if ( !IsPlayerRegistered(gPlayers[ plr ] )) SendClientMessage(playerid, COLOR_RED, " DOES NOT REGISTERED ");
        else if ( !IsPlayerRegistered(gPlayers[ plr2 ] )) SendClientMessage(playerid, COLOR_RED, " DOES NOT REGISTERED ");
      else
      {
         format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
         dini_IntSet( file, "Deaths", 0 );
         dini_IntSet( file, "Kills", 0 );
         format( szMsg, sizeof( szMsg ), "%s's stats reseted.", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
Kill = dini_Get( file, "Kills");
Death = dini_Get( file, "Deaths");
         format( file, sizeof( file ), USERS_FILE, gPlayers[ plr2 ] );
dini_IntSet( file, "Kills", Kill[plr] );
dini_IntSet( file, "Deaths", Death[plr] );
         format( szMsg, sizeof( szMsg ), "%s's stats transfered", gPlayers[ plr ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
      }
      
      return 1;
   }[/pawn]
My Servers Showroom!
www.jimxvcmpscripts.createaforum.com/

Quote from:  rohanaj60
i m a great script Editor

Rofl! lmao lol

Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Re: Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« Reply #1 on: April 10, 2013, 08:09:37 am »
But Data Players That Were There.
[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(

Offline stormeus

  • VC:MP Developer
  • VC:MP Veteran
  • *
  • Posts: 1122
    • View Profile
Re: Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« Reply #2 on: April 10, 2013, 01:42:30 pm »
Quote
[pawn]
format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
dini_IntSet( file, "Deaths", 0 );
dini_IntSet( file, "Kills", 0 );
format( szMsg, sizeof( szMsg ), "%s's stats reseted.", gPlayers[ plr ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );

format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
Kill = dini_Get( file, "Kills");
Death = dini_Get( file, "Deaths");

format( file, sizeof( file ), USERS_FILE, gPlayers[ plr2 ] );
dini_IntSet( file, "Kills", Kill[plr] );
dini_IntSet( file, "Deaths", Death[plr] );
[/pawn]

All of the transferred stats will just be equal to 0 because you reset the stats before saving them in a variable. Also, why are you using an array for the variables Kill and Death? Lastly, you didn't even create the variables Kill and Death, unless you made a new array at the top of the script, in which case you're still using it wrong because of this:
Quote
[pawn]
Kill = dini_Get( file, "Kills");
Death = dini_Get( file, "Deaths");
[/pawn]

That part should be:
[pawn]
format( file, sizeof( file ), USERS_FILE, gPlayers[ plr ] );
new Kill = dini_Get( file, "Kills");
new Death = dini_Get( file, "Deaths");
dini_IntSet( file, "Deaths", 0 );
dini_IntSet( file, "Kills", 0 );

format( szMsg, sizeof( szMsg ), "%s's stats reset.", gPlayers[ plr ] );
SendClientMessage( playerid, COLOR_GREEN, szMsg );

format( file, sizeof( file ), USERS_FILE, gPlayers[ plr2 ] );
dini_IntSet( file, "Kills", Kill );
dini_IntSet( file, "Deaths", Death );
[/pawn]

I didn't even bother checking the rest of the script thoroughly because this was the most obvious, but test your scripts before posting them or you won't be allowed to post them.
Do not PM me for support.




Offline aledark24

  • Made Man
  • ***
  • Posts: 206
  • I am a scripter and you have celous of me....so you crashed my servers
    • View Profile
Re: Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« Reply #3 on: April 10, 2013, 05:21:50 pm »
 :o :o :o another failed command...




note: today is my birthday....
I am a great scripter and you are celous of my works
.....

Vice City Life Multiplayer By Saint

Offline sseebbyy

  • VC:MP Veteran
  • *****
  • Posts: 774
  • Immortal VC:MP Player
    • View Profile
    • Zombie Invasion => Server Forum [DEAD PROJECT]
Re: Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« Reply #4 on: April 10, 2013, 06:01:05 pm »
note: today is my birthday....

OFF:

Happy Birthday :P

Quote
Painful/Noob scripters acts like: I Am The Best Scripter Because I Announce My Releases With Big Font Size Without Giving Too Much Info' In The Hope They All Will Download And Check It. I Ignore Bad Replies, Replies That I Could Learn From, And Replies With So Much Text.



Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: Reset,Transfer, Inc And Dec Stats By ME (GUPS)
« Reply #5 on: April 10, 2013, 08:55:15 pm »
note: today is my birthday....

Happy Birthday, aledark ) I've loggen-in my account especially to congratulate you, dude =)
Mrock, I see you won't start making more useful functions. This is useless because it's useless <- because it's useless. It's time to evolve, dude


-Funniest quotes-

Quote from: asad3man
i cant able to understand