Vice City Multiplayer

VC:MP => mIRC/pawn Scripting => Topic started by: MISHA123152 on August 12, 2010, 05:57:30 AM

Title: Not work
Post by: MISHA123152 on August 12, 2010, 05:57:30 AM
!givecash in GUPS1.16 not work.
Say: 'Error: Unknown player'
Title: Re: Not work
Post by: PlayerX on August 12, 2010, 07:47:33 AM
else if (strcmp(cmd, "!givecash", true) == 0) {
    new tmp2[256], plr;
tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
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;
}


rare :/
Title: Re: Not work
Post by: Jancis71 on August 12, 2010, 10:38:56 AM
all problems are here:
   else if (plr != INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");

!= change to ==

it should look like this:
else if (plr != INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");


and more one thing

find this line:      format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to:[ %s ]",tmp,gPlayers[playerid]);
and change this to  format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to:[ %s ]",StrToInt(tmp2),gPlayers[playerid]);
Title: Re: Not work
Post by: MISHA123152 on August 14, 2010, 07:27:18 PM
Give $1 player!!!!! Not Work!!!
Title: Re: Not work
Post by: Jancis71 on August 25, 2010, 08:34:59 PM
else if (strcmp(cmd, "!givecash", true) == 0) {
          new tmp2[256], plr;
         
      tmp = strtok(cmdtext, idx), tmp2 = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_TEXT, "You need to login first!");
      else if (!strlen(tmp2)) SendClientMessage(playerid,COLOR_TEXT, "USAGE: !givecash [Nick/ID] [Amount]");
      else if (GetPlayerHandCash(gPlayers[playerid]) < StrToInt(tmp2)) SendClientMessage(playerid,COLOR_TEXT, "Error: You havent got the needed money.");
      else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_TEXT,"Error: Unknown player");
      else if(!IsPlayerRegistered(gPlayers[plr])) SendClientMessage(playerid, COLOR_TEXT, "Error: That nick is not registered!");
      else if (!IsNumeric(tmp2)) SendClientMessage(playerid,COLOR_TEXT, "Error: Invalid Amount!");
      else {
         format(szMsg,sizeof(szMsg),"You have sent:[ $%d ] to:[ %s ]", StrToInt(tmp2),gPlayers[plr]);
         SendClientMessage(playerid,COLOR_TEXT, szMsg);
         DecPlayerHandCash(playerid,StrToInt(tmp2));
         IncPlayerHandCash(plr,StrToInt(tmp2));
      }
      return 1;
      }


change COLOR_TEXT to COLOR_GREEN for example.
Title: Re: Not work
Post by: MISHA123152 on August 26, 2010, 07:52:01 AM
Thanks!