Problem with /robbank
#1

Hello, i have one problem this command /robbank I walk in any checkpoint gives me money like I robbed the bank, and if a player gives his money killing me after I came and give me money
Код:
if(strcmp(cmd, "/robbank", true) == 0)
	{
		if(CooldownRob[playerid]) return SendClientMessage(playerid,COLOR_1BLUE,"{2BB3D5}* Banca poate fi sparta doar o data la 2 ore !");
		if(PlayerToPoint(3.0,playerid, 1237.7876,-729.1329,1088.0284))
		{
   			if(IsACop(playerid))
   			{
   			    SCM(playerid, COLOR_WHITE, "{F23A0D}* Nu poti sparge banca deoarece esti politist !");
   			    return 1;
		    }
   		    Robbing[playerid] = 1;
    		CP[playerid] = 50;
    		SetPlayerCheckpoint(playerid, 1460.9639, -1022.6666, 23.8281, 3.0);
			WantedLevel[playerid] = 0;
    		new wanted = GetPlayerWantedLevel(playerid);
			WantedLevel[playerid] = wanted + 10;
		    SetPlayerCriminal(playerid,255, "Ai spart banca  !");
			BizzInfo[0][bProducts] -= 20;
       		new name[MAX_PLAYER_NAME];
			GetPlayerName(playerid, name, sizeof(name));
			format(string, sizeof(string), "{FF0000}WARNING{FFFFFF}: %s a spart banca,omoara-l sa ii furi banii!", name);
			SendClientMessageToAll(COLOR_GREY, string);
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				CooldownRob[i] = 7200;
			}
		}
		else
   		{
   		    SendClientMessage(playerid, COLOR_GREY,"{C0C0C0}Trebuie sa fi in banca {ff0000}{C0C0C0} pentru a o jefui!");
			return 1;
		}
		return 1;
Код:
else if(CP[playerid] == 50)//Robbing1
    {
        CP[playerid] = 51;
        new rand;
        rand = random(sizeof(RandomRob));
        SetPlayerCheckpoint(playerid, RandomRob[rand][0],RandomRob[rand][1],RandomRob[rand][2], 3.0);
        SendClientMessage(playerid, COLOR_YELLOW, "Acum pleaca la depozit pentru a lua banii!");
    }
    else if(CP[playerid] == 51)//Robbing2
    {
        new cashr;
        new str[128];
        cashr = PlayerInfo[playerid][pLevel]*50000;
        PlayerInfo[playerid][pRob] -= 20;
//          PlayerInfo[playerid][pRobSkill] += 5;
        SafeGivePlayerMoney(playerid, cashr);
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        format(str, 128,"*Ai luat $%d pentru ca ai jefuit banca!", cashr);
        SendClientMessage(playerid, COLOR_YELLOW, str);
DisablePlayerCheckpoint(playerid);
CP[playerid] = 0;
    }
Reply
#2

Sorry, could you rephrase " and if a player gives his money killing me after I came and give me money"? I really can't understand this.
Reply
#3

Rob the bank then gives me money at any checkpoint, but then if I kill a player gives his money (sorry for my english.. )
Reply
#4

Do you mean if player uses /robbank, then he'll get money when entering checkpoint regardless of which one he enters?
It shouldn't happen according to your code, because CP[playerid] is checked correctly.

I don't get the killing part though. Also you should learn to indent your code properly (tab, and shift+tab will help you get started)
Reply
#5

Код:
 if(Robbing[playerid] == 1)
	{
 		DisablePlayerCheckpoint(playerid);
 		Robbing[playerid] = 0;
 		CP[playerid] = 0;
		new killer[MAX_PLAYER_NAME];
		new mort[MAX_PLAYER_NAME];
		GetPlayerName(playerid, mort, sizeof(mort));
		GetPlayerName(killerid, killer, sizeof(killer));
		format(string, sizeof(string), "» L-ai omorat pe %s si i-ai furat banii.Fuga la checkpoint!", mort);
		SendClientMessage(killerid, COLOR_1BLUE, string);
		format(string, sizeof(string), "%s l-a omorat pe %s si i-a furat toti banii!", killer, mort);
		SendClientMessageToAll(0xFF0000FF, string);
		CP[killerid] = 50;
		SetPlayerCheckpoint(killerid, -2597.8574,-982.0301,21.0064, 3.0);
		Robbing[killerid] = 1;
		if(IsPlayerConnected(playerid))//if(IsACop(killerid))
		{
		    DisablePlayerCheckpoint(playerid);
	 		Robbing[playerid] = 0;
	  		new banifurati;
	  		banifurati = copon*50000;
	 		CP[playerid] = 0;
			GetPlayerName(playerid, mort, sizeof(mort));
			GetPlayerName(killerid, killer, sizeof(killer));
			format(string, sizeof(string), "%s l-a omorat pe %s cand a spart banca.", killer, mort);
			SendClientMessageToAll(0xFF0000FF, string);
			GivePlayerMoney(killerid, banifurati);
		}
		return 1;
	}
When you rob a bank, get out into the car get in two checkpoints gives you money then done, but after gave me money if I kill a player gives his money
Reply
#6

nobody knows?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)