Author Topic: [Command Question][Need help with givecash]  (Read 5710 times)

0 Members and 1 Guest are viewing this topic.

Offline VC[88]PD

  • Wiseguy
  • **
  • Posts: 52
    • View Profile
[Command Question][Need help with givecash]
« on: February 09, 2013, 10:29:44 am »
Hi,all,I need help again.I made this command but it have many errors.Can you help me?
[pawn]    else if (strcmp(cmd, "!givecash", true) == 0)
   {
          tmp = strtok(cmdtext, idx);
        new len = strlen(tmp);
        new plr;
        plr = FindPlayerIDFromString(tmp);
         if (!len) { format(szMsg,sizeof(szMsg),"Usage: !givecash [playerid] [100/500/1000].",tmp);SendClientMessage(playerid, COLOR_GREY, szMsg);return 1;}
         else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
         else {
            if(strcmp(tmp, "100", true) == 0)
          {
         if {(GetPlayerMoney(playerid) < 100) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );return 1;}
         else{
        SetPlayerMoney(plr, GetPlayerMoney(plr) + 100);
        SetPlayerMoney(playerid, GetPlayerMoney(playerid) - 100);
        format(szMsg,256,"%s has use !givecash to given %s [100].",gPlayers[ playerid ],gPlayers[ plr ]);
          SendClientMessageToAll(COLOR_LIGHTBLUE, szMsg);
        }
        return 1;
        }
          else if(strcmp(tmp, "500", true) == 0)
         {
             if {(GetPlayerMoney(playerid) < 500) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );return 1;}
         else{
          SetPlayerMoney(plr, GetPlayerMoney(plr) + 500);
        SetPlayerMoney(playerid, GetPlayerMoney(playerid) - 500);
        format(szMsg,256,"%s has use !givecash to given %s [500].",gPlayers[ playerid ],gPlayers[ plr ]);
          SendClientMessageToAll(COLOR_LIGHTBLUE, szMsg);
          }
          return 1;
          }
         else if(strcmp(tmp, "1000", true) == 0)
         {
         if {(GetPlayerMoney(playerid) < 1000) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );return 1;}
         else{
             SetPlayerMoney(plr, GetPlayerMoney(plr) + 1000);
        SetPlayerMoney(playerid, GetPlayerMoney(playerid) - 1000);
        format(szMsg,256,"%s has use !givecash to given %s [1000].",gPlayers[ playerid ],gPlayers[ plr ]);
          SendClientMessageToAll(COLOR_LIGHTBLUE, szMsg);
          }
          return 1;
          }
        }
       return 1;
   }[/pawn]

errors:
Code: [Select]
D:\VCMP JIANFU2\gamemodes\mode.pwn(1744) : error 001: expected token: "(", but found "{"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1753) : error 029: invalid expression, assumed zero
D:\VCMP JIANFU2\gamemodes\mode.pwn(1753) : warning 215: expression has no effect
D:\VCMP JIANFU2\gamemodes\mode.pwn(1753) : error 001: expected token: ";", but found "if"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1755) : error 001: expected token: "(", but found "{"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1766) : error 001: expected token: "(", but found "{"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1768) : error 017: undefined symbol "plr"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1770) : error 017: undefined symbol "plr"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1775) : error 054: unmatched closing brace
D:\VCMP JIANFU2\gamemodes\mode.pwn(1776) : error 010: invalid function or declaration
D:\VCMP JIANFU2\gamemodes\mode.pwn(1778) : error 010: invalid function or declaration
Can you help me?
thanks

Offline VC[88]PD

  • Wiseguy
  • **
  • Posts: 52
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #1 on: February 09, 2013, 07:57:05 pm »
Who can help me!

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #2 on: February 10, 2013, 01:11:49 am »
I'llhelp u tomorrow, now I'm going to sleep  ::)


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Re: [Command Question][Need help with givecash]
« Reply #3 on: February 10, 2013, 03:08:31 am »
Who can help me!
Wait for a min i will help u (cause i cant see prob on my phone)
Hell I Cant see The Line  :o
EDITED : Its Create My Pawno Library Crash
« Last Edit: February 10, 2013, 04:26:05 am by dynavolt71 »
[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(

Offline mrockxkingbutt

  • Crime Boss
  • ****
  • Posts: 373
  • I AM Best Scripter And You Are Not :P
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #4 on: February 10, 2013, 03:11:11 pm »
use simple
[pawn]      else if ( strcmp( cmd, "!givecash", true ) == 0 )
   {
          new tmp2[ 256 ], plr;
      tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !givecash [Nick/ID] [Amount]" );
      else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );
      else if ( plr != INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
      else if ( !IsPlayerRegistered(gPlayers[ plr ]) ) SendClientMessage( playerid, COLOR_RED, "Error: That nick is not registered!" );
      else if ( !IsNumeric(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: Invalid Amount!" );
      else
      {
         format( szMsg, sizeof( szMsg ), "You have sent:[ $%d ] to:[ %s ]",tmp, gPlayers[ playerid ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
         DecPlayerHandCash( playerid,StrToInt( tmp ) );
         IncPlayerHandCash( plr,StrToInt( tmp ) );
      }
      return 1;
      }[/pawn]
My Servers Showroom!
www.jimxvcmpscripts.createaforum.com/

Quote from:  rohanaj60
i m a great script Editor

Rofl! lmao lol

Offline VC[88]PD

  • Wiseguy
  • **
  • Posts: 52
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #5 on: February 10, 2013, 07:18:57 pm »
use simple
[pawn]      else if ( strcmp( cmd, "!givecash", true ) == 0 )
   {
          new tmp2[ 256 ], plr;
      tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_RED, "Please log-in to your account." );
      else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "USAGE: !givecash [Nick/ID] [Amount]" );
      else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: You havent got the needed money." );
      else if ( plr != INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
      else if ( !IsPlayerRegistered(gPlayers[ plr ]) ) SendClientMessage( playerid, COLOR_RED, "Error: That nick is not registered!" );
      else if ( !IsNumeric(tmp2) ) SendClientMessage( playerid, COLOR_GREEN, "Error: Invalid Amount!" );
      else
      {
         format( szMsg, sizeof( szMsg ), "You have sent:[ $%d ] to:[ %s ]",tmp, gPlayers[ playerid ] );
         SendClientMessage( playerid, COLOR_GREEN, szMsg );
         DecPlayerHandCash( playerid,StrToInt( tmp ) );
         IncPlayerHandCash( plr,StrToInt( tmp ) );
      }
      return 1;
      }[/pawn]
But I haven't used GUPS!![/color]

Offline JaVeD

  • Street Thug
  • *
  • Posts: 46
  • Want scripts? Pm me now! Just for $
    • View Profile
    • Free Host -> Clicky
Re: [Command Question][Need help with givecash]
« Reply #6 on: February 11, 2013, 06:21:42 am »
Put the GUPS !givecash script in your server and compile then show me what error coming then we fix it this is not good givecash scrip dont use >100 >1000 or else use tmp what ammount player want to give to someone :D TRy that script :

[pawn]else if ( strcmp( cmd, "!givecash", true ) == 0 )
   {
          new tmp2[ 256 ], plr;
      tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_GREEN, "Please log-in to your account." );
      else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_YELLOW, "USAGE: !givecash [Nick/ID] [Amount]" );
      else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt(tmp2) ) SendClientMessage( playerid, ORANGE, "You havent got the needed money." );
      else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
      else if ( !IsPlayerRegistered(gPlayers[ plr ]) ) SendClientMessage( playerid, GREEN, "That nick is not registered!" );
      else if ( !IsNumeric(tmp2) ) SendClientMessage( playerid, COLOR_RED, "Invalid Amount!" );
      else
      {
         format( szMsg, sizeof( szMsg ), "You have sent:[ $%d ] to:[ %s ]",tmp, gPlayers[ playerid ] );
         SendClientMessage( playerid, GREEN, szMsg );
         DecPlayerHandCash( playerid,StrToInt( tmp ) );
         IncPlayerHandCash( plr,StrToInt( tmp ) );
      }
      return 1;
      }[/pawn]
SA:MP Server: 5.231.49.21:7777
Website: www.nse-server.com

Offline dynavolt71

  • Crime Boss
  • ****
  • Posts: 371
    • View Profile
    • My Blog
Re: [Command Question][Need help with givecash]
« Reply #7 on: February 11, 2013, 10:32:31 am »
IsLoggedIn
IsPlayerRegistered
DecPlayerHandCash( playerid,StrToInt( tmp ) );
IncPlayerHandCash( plr,StrToInt( tmp ) );


This Function Is FORM GUPS But Im Not Sure

[PAWNO]Fix Error " Failed to set data for "" " - http://forum.vicecitymultiplayer.com/index.php?topic=5743.0



:'(

Offline VC[88]PD

  • Wiseguy
  • **
  • Posts: 52
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #8 on: February 11, 2013, 10:42:39 am »
Put the GUPS !givecash script in your server and compile then show me what error coming then we fix it this is not good givecash scrip dont use >100 >1000 or else use tmp what ammount player want to give to someone :D TRy that script :

[pawn]else if ( strcmp( cmd, "!givecash", true ) == 0 )
   {
          new tmp2[ 256 ], plr;
      tmp = strtok( cmdtext, idx ), tmp2 = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
      if ( !IsLoggedIn( playerid ) ) SendClientMessage( playerid, COLOR_GREEN, "Please log-in to your account." );
      else if ( !strlen(tmp2) ) SendClientMessage( playerid, COLOR_YELLOW, "USAGE: !givecash [Nick/ID] [Amount]" );
      else if (GetPlayerHandCash(gPlayers[ playerid ]) < StrToInt(tmp2) ) SendClientMessage( playerid, ORANGE, "You havent got the needed money." );
      else if ( plr == INACTIVE_PLAYER_ID ) SendClientMessage( playerid, COLOR_RED, "Error: Unknown player" );
      else if ( !IsPlayerRegistered(gPlayers[ plr ]) ) SendClientMessage( playerid, GREEN, "That nick is not registered!" );
      else if ( !IsNumeric(tmp2) ) SendClientMessage( playerid, COLOR_RED, "Invalid Amount!" );
      else
      {
         format( szMsg, sizeof( szMsg ), "You have sent:[ $%d ] to:[ %s ]",tmp, gPlayers[ playerid ] );
         SendClientMessage( playerid, GREEN, szMsg );
         DecPlayerHandCash( playerid,StrToInt( tmp ) );
         IncPlayerHandCash( plr,StrToInt( tmp ) );
      }
      return 1;
      }[/pawn]
D:\VCMP JIANFU2\gamemodes\mode.pwn(1787) : error 017: undefined symbol "IsLoggedIn"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1789) : error 017: undefined symbol "GetPlayerHandCash"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1791) : error 017: undefined symbol "IsPlayerRegistered"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1792) : error 017: undefined symbol "IsNumeric"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1797) : error 017: undefined symbol "DecPlayerHandCash"
D:\VCMP JIANFU2\gamemodes\mode.pwn(1798) : error 017: undefined symbol "IncPlayerHandCash"

Offline JaVeD

  • Street Thug
  • *
  • Posts: 46
  • Want scripts? Pm me now! Just for $
    • View Profile
    • Free Host -> Clicky
Re: [Command Question][Need help with givecash]
« Reply #9 on: February 11, 2013, 10:57:23 am »
PUT THIS IN PUBLIC

[pawn]
public GetPlayerHandCash( player[] )
{
   new xg;
   format( file, sizeof( file ), USERS_FILE, player);
   xg = dini_Int( file, "Cash" );
   return xg;
}
public DecPlayerHandCash( playerid, Amount )
{
   format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
   new cash; cash = dini_Int( file, "Cash" );
   dini_IntSet( file, "Cash", cash -Amount);
   SetPlayerMoney( playerid,GetPlayerHandCash(gPlayers[ playerid ]) );
}

public IncPlayerHandCash( playerid, Amount )
{
   format( file, sizeof( file ), USERS_FILE, gPlayers[ playerid ] );
   new cash; cash = dini_Int( file, "Cash" );
   dini_IntSet( file, "Cash", cash +Amount);
   SetPlayerMoney( playerid,GetPlayerHandCash(gPlayers[ playerid ]) );
}
isnumeric( const string[] )
{// mike's function
   for ( new i = 0, j = strlen( string ); i < j; i++ ) { if ( string[ i ] > '9' || string[ i ] < '0' ) return 0; }
   return 1;
}[/pawn]

And on stock
[pawn]stock IsNumeric( string[] ) { for (new i = 0, j = strlen( string ); i < j; i++ ) if ( string > '9' || string < '0') return 0; return 1; }

stock IsLoggedIn( id )
{
   return ( PlayerInfo[ id ][ Logged ] == 1 ) ? true : false;
}[/pawn]

[pawn]stock IsRegistered( id )
{
   return ( PlayerInfo[ id ][ Logged ] == 2 ) ? true : false;
}

stock IsPlayerRegistered( player[] )
{ // We need to give the full nick name.
   format( file, sizeof( file ), USERS_FILE, player);
   return ( dini_Exists( file ) ) ? true : false;
}[/pawn]

Note: u can edit the file locations like where is your user file and cash ini edit and put ur script cash location and i hope it will be work :D
SA:MP Server: 5.231.49.21:7777
Website: www.nse-server.com

Offline aledark24

  • Made Man
  • ***
  • Posts: 206
  • I am a scripter and you have celous of me....so you crashed my servers
    • View Profile
Re: [Command Question][Need help with givecash]
« Reply #10 on: February 11, 2013, 10:30:45 pm »
yeah is givecash of gups... but not working because use 2 tmp and need tmp and tmp2 to send to another player xD


another time i help you now i posted how change ban system of gups xD
I am a great scripter and you are celous of my works
.....

Vice City Life Multiplayer By Saint