• Welcome to Vice City Multiplayer.
 

Help Please

Started by Dawood136, March 04, 2011, 05:00:08 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Dawood136

my !givecash is buged when some one do !givecash [playername/id] [ammount] it says invalid player i tried alot but it don't work

My Code :

      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;
    }
Signed,
Dawood Sahi
DSS RPG Owner/Leader

BIG[H]

use /c givefuck to send cash
My Guru FORUM MUST VISITmegavcmp.freeforums.org

BIG[H] = BIG HaLL

Dawood136

Signed,
Dawood Sahi
DSS RPG Owner/Leader

yazeen

Quote from: Dawood136 on March 08, 2011, 02:27:15 PM
HELP HELP!!

simple


if(strcmp(cmd, "!givecash", true) == 0) {
    new giveplayerid, moneys;
    new giveplayer[MAX_PLAYER_NAME];
    new playermoney;
new sendername[MAX_PLAYER_NAME];
    new tmp[256];
tmp = strtok(cmdtext, idx);
new string[256];

if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: !givecash [playerid] [amount]");
return 1;
}
giveplayerid = strval(tmp);

tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, "USAGE: !givecash [playerid] [amount]");
return 1;
}
moneys = strval(tmp);


if (giveplayerid == playerid) return SendClientMessage(playerid,COLOR_YELLOW,"You Cant Send Cash To Yourself");
if (IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
playermoney = GetPlayerMoney(playerid);
if (moneys > 0 && playermoney >= moneys) {
SetPlayerMoney(playerid,playermoney-moneys);
SetPlayerMoney(giveplayerid,playermoney+moneys);
format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
}
else {
SendClientMessage(playerid, COLOR_YELLOW, "Invalid cash amount.");
}
}
else {
format(string, sizeof(string), "%d is invalid player id.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
return 1;
}

Dawood136

Mr.Yazeen Do you revived me email on yahoo ?

Our Dss rpg script is sent to big and u , big is working on it many cmds are added
Signed,
Dawood Sahi
DSS RPG Owner/Leader

Dawood136

Problem Released , TOPIC CLOSED (LOCKED)
Signed,
Dawood Sahi
DSS RPG Owner/Leader