[HELP] Block transmission of Money
#1

How to block sending money to a player who is in an arena x1?

Command x1:
Code:
 	if (strcmp(cmdtext,"/x1", true)==0)
	{
    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, COLOR_RED, "You need $ 200 to use the teleportation!");
	SetPlayerInterior(playerid,0);  
	SetPlayerPos(playerid,1890.046,-1316.395,49.069);
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(string, sizeof(string), "*** %s was to o x1 (/x1)", pname);
    SendClientMessageToAll(COLOR_YELLOW, string);
    GivePlayerWeapon(playerid,4,0);
    GivePlayerWeapon(playerid,26,1000);
    GivePlayerWeapon(playerid,31,1000);
    GivePlayerWeapon(playerid,24,1000);
    GivePlayerWeapon(playerid,32,1000);
	return 1;
	}
command to give money:
Code:
if(strcmp(cmd, "/transfer", true) == 0) {
	  new tmp[256];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "TYPE: /transfer [id] [amount]");
			return 1;
		}
		giveplayerid = strval(tmp);

		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "TYPE: /transfer [id] [amount]");
			return 1;
		}
 		moneys = strval(tmp);
Reply
#2

well I suggest you add another variable that changes depending on where they go, so x1 would have its own id and you can block things more easily that way
Reply
#3

pawn Code:
// TOp of the script
new bool:gArena[MAX_PLAYERS];

if (strcmp(cmdtext,"/x1", true)==0)
    {
    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, COLOR_RED, "You need $ 200 to use the teleportation!");
    SetPlayerInterior(playerid,0);  
    SetPlayerPos(playerid,1890.046,-1316.395,49.069);
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(string, sizeof(string), "*** %s was to o x1 (/x1)", pname);
    gArena[playerid] == true;
    SendClientMessageToAll(COLOR_YELLOW, string);
    GivePlayerWeapon(playerid,4,0);
    GivePlayerWeapon(playerid,26,1000);
    GivePlayerWeapon(playerid,31,1000);
    GivePlayerWeapon(playerid,24,1000);
    GivePlayerWeapon(playerid,32,1000);
    return 1;
    }

    if(strcmp(cmd, "/transfer", true) == 0) {
      new tmp[256];
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "TYPE: /transfer [id] [amount]");
            return 1;
        }
        giveplayerid = strval(tmp);
        if(gArena[giveplayerid] == true){
           SendClientMessage(playerid, COLOR_WHITE, "He is in Arena you can't send him money");
           return 1;
         }
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "TYPE: /transfer [id] [amount]");
            return 1;
        }
        moneys = strval(tmp);
Remember to set gArena[playerid] == false; when he leaves the arena and OnPlayerConnect.
Reply
#4

I put the gArena[playerid] == false; happened in OnPlayerDeath and 2 errors
Code:
if (strcmp(cmdtext,"/x1", true)==0)
	{
    if(GetPlayerMoney(playerid) < 200) return SendClientMessage(playerid, COLOR_RED, "You need $ 200 to use the teleportation!");
	SetPlayerInterior(playerid,0);  
	SetPlayerPos(playerid,1890.046,-1316.395,49.069);
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    format(string, sizeof(string), "*** %s was to o x1 (/x1)", pname);
    gArena[playerid] == true; //1 ERROR
    SendClientMessageToAll(COLOR_YELLOW, string);
    GivePlayerWeapon(playerid,4,0);
    GivePlayerWeapon(playerid,26,1000);
    GivePlayerWeapon(playerid,31,1000);
    GivePlayerWeapon(playerid,24,1000);
    GivePlayerWeapon(playerid,32,1000);
	return 1;
	}
Code:
public OnPlayerDeath(playerid, killerid, reason)
{
  new playercash;
	new killedplayer[MAX_PLAYER_NAME];
	new string[256];
	Arena[playerid] = 0;
	gArena[playerid] == false; //2 ERROR
Lines in the arena with error:
Code:
gArena[playerid] == true; //1 ERROR
At OnPlayerDeath:
Code:
gArena[playerid] == false; //2 ERROR
ERROR:
Code:
warning 215: expression has no effect
warning 215: expression has no effect
Reply
#5

sorry it was my mistake

gArena[playerid] = false;
gArena[playerid] = true;

use == when you check for condition
Reply


Forum Jump:


Users browsing this thread: