SA-MP Forums Archive
A small problem. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A small problem. (/showthread.php?tid=475317)



A small problem. - Gogorakis - 12.11.2013

Hello SA:MP,

I need help. I just installed a bank robbery system (filescript)...It works fine but when someone finish the robbery, the system give some money but it takes them back...I dont really know if the server causes this problem but here is the CMD..

Код:
CMD:robbank(playerid, params[])
{
	if(robpossible == 1) //If the bank can be robbed we continue below
	{
		if(IsPlayerInRangeOfPoint(playerid, 5.0, 1424.634521,-1003.469665,1639.784301))
		{//Next thing we do is, we check if we are at the bank interior ^^
		    robpossible = 0; //Then we set the bank so it cannot be robbed
		    SetTimer("waittimer", 2400000, false); //Normal Mode 5 minutes
		    /*We run the timer(5 minutes) for the function that is going to make the
		    bank available for robbing again
		    */
		    //SetTimer("waittimer", 300000, false); //Test Mode 65 seconds
		    SetTimer("robtimer", 180000, false);
		    /* We also run another timer(1 minute) for the function that is
		    actually going to give us the money and a user friendly message.
		    */
		    /*
		    Add a function that would notify the police.
		    */
		    SendClientMessage(playerid, COLOR_WHITE, "You are robbing the bank, the police has been notified!");
            SendClientMessage(playerid, COLOR_WHITE, "You gotta stay 3 minutes in the bank in order to rob it!");
		    SendClientMessageToAll(COLOR_WHITE, "{FF0000}CITY ALERT: A bank robbery has been noted!");

		 }
	} else {
	    SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!");
	}
	return 1;
}
THANK YOU!


Re: A small problem. - Loot - 12.11.2013

Show me the waittimer() public function and robtimer().


Re: A small problem. - Gogorakis - 12.11.2013

Код:
public robtimer(playerid)
{
	new string[128];//We are defining a new string for the formatted message that we are displaying later on.
    new cash = random(200000);
	GivePlayerMoney(playerid, cash);
	/*
    With the fuction above 'new cash = random(200000);
	GivePlayerMoney(playerid, cash);' we give the player
    a random amount of money from $0 - $200,000
    */
    //Here below we use the string we defined above to format the message itself and display it to the player.
	format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
	SendClientMessage(playerid, COLOR_WHITE, string);
}

public waittimer()
{
	robpossible = 1; //With this we make the bank available for robbery again, and we display a friendly message to all players.
	SendClientMessageToAll(COLOR_WHITE, "[OOC]The bank is now available for robbery![OOC]");
}



Re: A small problem. - Loot - 12.11.2013

Do you have an anti cheat by any chance? (server slided money).


Re: A small problem. - Gogorakis - 12.11.2013

Quote:
Originally Posted by Loot
Посмотреть сообщение
Do you have an anti cheat by any chance? (server slided money).
I dont know (I have to ask my scripter) but I think no because I dont have Anti-Airbrake Hack or Anti-Fly Hack etc..


Re: A small problem. - Loot - 12.11.2013

Al I can see is that when the timers ends, he gets a random cash amount of 1-200K, there's no way to take off that cash again with the snippets you've provided.
Mostly, servers with money anti cheat has their own functions to give cash, and when the player 'spawns' cash, it'll basically take it off from him.
For instance:
pawn Код:
GivePlayerCash(playerid, cash)
{
     myCash[playerid] += cash;
     return GivePlayerMoney(playerid, cash);
}
Check in your global timers, if there's a player money check.


Re: A small problem. - Gogorakis - 12.11.2013

Код:
stock GivePlayerCash(playerid, money)
{
	SetPVarInt(playerid, "Cash", GetPVarInt(playerid, "Cash")+money);
	GivePlayerMoney(playerid, money);
	return 1;
}
Here is my function..
Should I put it in the filescript or something? I have to change the..?
Код:
public robtimer(playerid)
{
	new string[128];//We are defining a new string for the formatted message that we are displaying later on.
    new cash = random(200000);
	GivePlayerMoney(playerid, cash);
	/*
    With the fuction above 'new cash = random(200000);
	GivePlayerMoney(playerid, cash);' we give the player
    a random amount of money from $0 - $200,000
    */
    //Here below we use the string we defined above to format the message itself and display it to the player.
	format(string, sizeof(string), "You have successfully robbed $%d from the bank!", cash);
	SendClientMessage(playerid, COLOR_WHITE, string);
}



Re: A small problem. - Loot - 12.11.2013

That's the problem while having different filterscripts.
Just add those server slided cash functions to the rob bank filterscript, unless if you're willing to add the filterscript functions to your GM and still giving credits to its author.
EDIT: change the following code from:
pawn Код:
GivePlayerMoney(playerid, cash);
To:
pawn Код:
GivePlayerCash(playerid, cash);



Re: A small problem. - Gogorakis - 12.11.2013

Quote:
Originally Posted by Loot
Посмотреть сообщение
That's the problem while having different filterscripts.
Just add those server slided cash functions to the rob bank filterscript, unless if you're willing to add the filterscript functions to your GM and still giving credits to its author.
EDIT: change the following code from:
pawn Код:
GivePlayerMoney(playerid, cash);
To:
pawn Код:
GivePlayerCash(playerid, cash);
It gives me error with the undefine symbol "GivePlayerCash". How can I define it?


Re: A small problem. - Loot - 12.11.2013

Quote:
Originally Posted by Loot
Посмотреть сообщение
Just add those server slided cash functions to the rob bank filterscript, unless if you're willing to add the filterscript functions to your GM and still giving credits to its author.
Did you?