Bank robbery script help? [+REP] - 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: Bank robbery script help? [+REP] (
/showthread.php?tid=583850)
Bank robbery script help? [+REP] -
Lunixx - 31.07.2015
pawn Код:
CMD:robbank(playerid, params[])
{
if(robpossible == 1) //If the bank can be robbed we continue below
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 2309.1899,-8.4444,26.7422))
{//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", 300000, 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", 65000, false); //Test Mode 65 seconds
SetTimer("robtimer", 60000, 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 30 seconds in the bank in order to rob it!");
}
} else {
SendClientMessage(playerid, COLOR_WHITE, "You can't rob the bank right now!");
}
return 1;
}
//Functions
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(250000);
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);
}
How can i add somekind of funtion that right before it says "You are robbing bank. Police has been notified"
It sends an meassage to Police factions that bank is being robber?
Re: Bank robbery script help? [+REP] -
nezo2001 - 31.07.2015
PHP код:
for(new i = 0;i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][police] > 0) //PlayerInfo and police depends on your enum
{
SendClientMessage(i, -1, "The bank is being robber!");
}
}
Re: Bank robbery script help? [+REP] -
Moudix - 31.07.2015
What's your pd faction variable?
Re: Bank robbery script help? [+REP] -
Jakwob - 31.07.2015
Код:
stock SendPoliceMessage(color, const len[])
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][police] >= 1) SendClientMessage(i, color, len);
}
return 1;
}
Then use
Код:
SendPoliceMessage(color, "The bank is being robbed");
you can then use SendPoliceMessage when needed and just change the text
Re: Bank robbery script help? [+REP] -
Lunixx - 31.07.2015
pawn Код:
C:\Users\Artur\Downloads\PZGRP\filterscripts\bankrobbery.pwn(49) : error 029: invalid expression, assumed zero
C:\Users\Artur\Downloads\PZGRP\filterscripts\bankrobbery.pwn(49) : warning 215: expression has no effect
C:\Users\Artur\Downloads\PZGRP\filterscripts\bankrobbery.pwn(49) : error 001: expected token: ";", but found "]"
C:\Users\Artur\Downloads\PZGRP\filterscripts\bankrobbery.pwn(49) : error 029: invalid expression, assumed zero
C:\Users\Artur\Downloads\PZGRP\filterscripts\bankrobbery.pwn(49) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
LINE 49
pawn Код:
if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1);
Re: Bank robbery script help? [+REP] -
morjan - 31.07.2015
if you make a if you cannt close it whit this ; it must be {
Код:
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{