[Nito] /pay command error
#1

Guys, i put this command for /pay in my script and i ge this errors what must i do to fix it? help please!

Код:
if(strcmp(cmd, "/pay", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
				return 1;
			}
			//giveplayerid = strval(tmp);
	        giveplayerid = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
				return 1;
			}
			moneys = strval(tmp);
			if (IsPlayerConnected(giveplayerid))
			{
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
			        if(PlayerInfo[giveplayerid][pLocal] == 106)
					{
						SendClientMessage(playerid, COLOR_GRAD1, "Command not allowed in this location");
						return 1;
					}
					if (ProxDetectorS(5.0, playerid, giveplayerid))
					{
					    if(giveplayerid == playerid)
					    {
					        SendClientMessage(playerid, COLOR_GREY, "   You can not pay for yourself !");
					        return 1;
					    }
					    new y,m,d;
						new h,mi,s;
						getdate(y,m,d);
						gettime(h,mi,s);
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						playermoney = GetPlayerMoney(playerid);
						if (moneys > 0 && playermoney >= moneys)
						{
						    if (playermoney > ScriptMoney[playerid])
							{
							    if(admins == 0 || afkadmins == admins)
								{
							  		format(string, sizeof(string), "%s (%d), Has been Banned by The Anticheat Peter Griffin for Possible Money Hacking.", sendername, playerid);
									SendClientMessageToAll(COLOR_NICERED, string);
									format(string, sizeof(string), "You have Been Banned by The Anticheat For Possible Weapon Money Hacking ($%d)",(GetPlayerMoney(playerid) - ScriptMoney[playerid]));
									SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
									format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] Anticheat Has Banned %s for: Money Hacking",d,m,y,h,mi,s,sendername);
									BanLog(string);
									ScriptBan(playerid,999,"Money Hacks");
								}
								format(string, sizeof(string), "[PETER]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
								SendAdminMessage(COLOR_YELLOW, string);
								PlayerSuspicious[playerid] = 1;
								PlayerMoneyHacking[playerid] = 1;
								PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
								PlayerGotSpottedRecently[playerid] = 1;
								SetTimerEx("ResetAcWarn", 90000, 0, "i", playerid);
								SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
								return 1;
							}
							SafeGivePlayerMoney(playerid, (0 - moneys));
							SafeGivePlayerMoney(giveplayerid, moneys);
							format(string, sizeof(string), "** You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
							PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
							SendClientMessage(playerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "** You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
							SendClientMessage(giveplayerid, COLOR_GRAD1, string);
							format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s has paid $%d to %s",d,m,y,h,mi,s, sendername, moneys, giveplayer);
							PayLog(string);
							if(moneys >= 1000000)
							{
							    format(string, sizeof(string),"[PETER]: %s (%d) Has Paid $%d To %s (%d).", sendername, playerid, moneys, giveplayer, giveplayerid);
								SendAdminMessage(COLOR_YELLOW,string);
							}
							PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
							format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
							ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount.");
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
					}
				}//invalid id
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
ERRORS:

C:\Documents and Settings\User\Desktop\bare.pwn(10) : error 010: invalid function or declaration
C:\Documents and Settings\User\Desktop\bare.pwn(30) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Documents and Settings\User\Desktop\bare.pwn(42) : error 017: undefined symbol "tmp"
C:\Documents and Settings\User\Desktop\bare.pwn(43) : error 017: undefined symbol "tmp"
C:\Documents and Settings\User\Desktop\bare.pwn(49) : error 017: undefined symbol "ReturnUser"
C:\Documents and Settings\User\Desktop\bare.pwn(50) : error 017: undefined symbol "tmp"
C:\Documents and Settings\User\Desktop\bare.pwn(51) : error 017: undefined symbol "tmp"
C:\Documents and Settings\User\Desktop\bare.pwn(56) : error 017: undefined symbol "tmp"
C:\Documents and Settings\User\Desktop\bare.pwn(61) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\User\Desktop\bare.pwn(61) : warning 215: expression has no effect
C:\Documents and Settings\User\Desktop\bare.pwn(61) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\User\Desktop\bare.pwn(61) : error 029: invalid expression, assumed zero
C:\Documents and Settings\User\Desktop\bare.pwn(61) : fatal error 107: too many error messages on one line
Reply
#2

Any help? :/
Reply
#3

pawn Код:
if(strcmp(cmd, "/pay", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
                        new tmp[256];
                        new idx;
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
                return 1;
            }
            //giveplayerid = strval(tmp);
            giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /pay [playerid/PartOfName] [amount]");
                return 1;
            }
            moneys = strval(tmp);
            if (IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    if(PlayerInfo[giveplayerid][pLocal] == 106)
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "Command not allowed in this location");
                        return 1;
                    }
                    if (ProxDetectorS(5.0, playerid, giveplayerid))
                    {
                        if(giveplayerid == playerid)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "   You can not pay for yourself !");
                            return 1;
                        }
                        new y,m,d;
                        new h,mi,s;
                        getdate(y,m,d);
                        gettime(h,mi,s);
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        playermoney = GetPlayerMoney(playerid);
                        if (moneys > 0 && playermoney >= moneys)
                        {
                            if (playermoney > ScriptMoney[playerid])
                            {
                                if(admins == 0 || afkadmins == admins)
                                {
                                    format(string, sizeof(string), "%s (%d), Has been Banned by The Anticheat Peter Griffin for Possible Money Hacking.", sendername, playerid);
                                    SendClientMessageToAll(COLOR_NICERED, string);
                                    format(string, sizeof(string), "You have Been Banned by The Anticheat For Possible Weapon Money Hacking ($%d)",(GetPlayerMoney(playerid) - ScriptMoney[playerid]));
                                    SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
                                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] Anticheat Has Banned %s for: Money Hacking",d,m,y,h,mi,s,sendername);
                                    BanLog(string);
                                    ScriptBan(playerid,999,"Money Hacks");
                                }
                                format(string, sizeof(string), "[PETER]: %s (%d) Is possibly Using Money Hacks; Check him inmediately!!", sendername,playerid);
                                SendAdminMessage(COLOR_YELLOW, string);
                                PlayerSuspicious[playerid] = 1;
                                PlayerMoneyHacking[playerid] = 1;
                                PlayerSuspiciousMoney[playerid] = (GetPlayerMoney(playerid) - ScriptMoney[playerid]);
                                PlayerGotSpottedRecently[playerid] = 1;
                                SetTimerEx("ResetAcWarn", 90000, 0, "i", playerid);
                                SendClientMessage(playerid, COLOR_CREAM, "* Transaction Stopped, you're probably on a cash inbalance, contact an administrator.");
                                return 1;
                            }
                            SafeGivePlayerMoney(playerid, (0 - moneys));
                            SafeGivePlayerMoney(giveplayerid, moneys);
                            format(string, sizeof(string), "** You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            SendClientMessage(playerid, COLOR_GRAD1, string);
                            format(string, sizeof(string), "** You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
                            SendClientMessage(giveplayerid, COLOR_GRAD1, string);
                            format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s has paid $%d to %s",d,m,y,h,mi,s, sendername, moneys, giveplayer);
                            PayLog(string);
                            if(moneys >= 1000000)
                            {
                                format(string, sizeof(string),"[PETER]: %s (%d) Has Paid $%d To %s (%d).", sendername, playerid, moneys, giveplayer, giveplayerid);
                                SendAdminMessage(COLOR_YELLOW,string);
                            }
                            PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
                            format(string, sizeof(string), "* %s takes out some cash, and hands it to %s.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "   Invalid transaction amount.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "   Your too far away.");
                    }
                }//invalid id
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
pawn Код:
if(PlayerInfo[giveplayerid][pLocal] == 106)
                    {

replace there your admin code ...
Other i dont know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)