Author Topic: Not work  (Read 3982 times)

0 Members and 1 Guest are viewing this topic.

Offline MISHA123152

  • Street Thug
  • *
  • Posts: 46
    • View Profile
    • Russian Server
Not work
« on: August 12, 2010, 06:57:30 am »
!givecash in GUPS1.16 not work.
Say: 'Error: Unknown player'

Offline PlayerX

  • Street Thug
  • *
  • Posts: 17
    • View Profile
Re: Not work
« Reply #1 on: August 12, 2010, 08:47:33 am »
Code: [Select]
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 :/

Offline Jancis71

  • Street Thug
  • *
  • Posts: 21
    • View Profile
Re: Not work
« Reply #2 on: August 12, 2010, 11: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]);

Offline MISHA123152

  • Street Thug
  • *
  • Posts: 46
    • View Profile
    • Russian Server
Re: Not work
« Reply #3 on: August 14, 2010, 08:27:18 pm »
Give $1 player!!!!! Not Work!!!

Offline Jancis71

  • Street Thug
  • *
  • Posts: 21
    • View Profile
Re: Not work
« Reply #4 on: August 25, 2010, 09: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.

Offline MISHA123152

  • Street Thug
  • *
  • Posts: 46
    • View Profile
    • Russian Server
Re: Not work
« Reply #5 on: August 26, 2010, 08:52:01 am »
Thanks!