• Welcome to Vice City Multiplayer.
 

Not work

Started by MISHA123152, August 12, 2010, 04:57:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MISHA123152

!givecash in GUPS1.16 not work.
Say: 'Error: Unknown player'
Experience VCMP: 4 years.
Professional coder: gamemodes, filterscripts.

PlayerX

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 :/

Jancis71

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]);

MISHA123152

Give $1 player!!!!! Not Work!!!
Experience VCMP: 4 years.
Professional coder: gamemodes, filterscripts.

Jancis71

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.

MISHA123152

Experience VCMP: 4 years.
Professional coder: gamemodes, filterscripts.