CNR Robbery places LV [REP+]
#1

Hi guys 2 nd post ok btw i wanted to know how to make a robbery places in lv e.g like you go in burger shot and there is checkpoint u can type /robstore and u doing robbery dont be aggresive and dont say learns pawn yourself i learning dont be aggresive so thanks and help will be appreciated!
Reply
#2

Here's an example of Bank robbery by detecting whether player is in that Bank's interior or not.

pawn Код:
new Time[MAX_PLAYERS]; //Creating a variable.
//We'll use this as a time variable so as to prevent frequent robberies.

CMD:brob(playerid,params[]) //Creating the command using zcmd.
{
   if(Time[playerid] == 1) //Detecting if the player has robbed before or not.
   { //If yes,
      SendClientMessage(playerid, 0xFF0000, "You have just done a robbery. Please wait for sometime."); //Messaging to wait for sometime for next robbery.
   } //Closing and if not robbed,
   new interior; //Creating a variable as interior.
   interior = GetPlayerInterior(playerid); //Using the variable to detect player's interior.
   if(interior == 0) //Checking whether the detected interior is 0. 0 here used is the interior id of the bank.
//You can get more id's on wiki samp.
   { //If player is in that interior.
     GivePlayerMoney(playerid,100000); //Giving player money to regard that he robbed.
     Time[playerid]=1; //Changing the time variable to 1 so it'll be that the player has robbed.
     SendClientMessage(playerid, 0xFF0000, "You have successfully robbed a bank."); //A message to player regarding his successful robbery.
     SetTimerEx("disabletime", 900000,false,"d",playerid); //Creating a timer for 15 minutes which can disable the time variable so that the player can rob after 15 minutes.
   } //Closing the opened brackets.
   else //Using else statement to switch that if player is not in the correct interior,
   { //Opening brackets to execute function.
     SendClientMessage(playerid, 0xFF0000, "You must be in a bank to use this command."); //Giving a message that player should be in a bank to use this command.
   } //Closing the brackets.
   return 1; //Returning functions.
} //Closing command.

forward disabletime() //Forwarding our timer.

public disabletime(playerid) //Creating disabletime function which we've used in the time.
{ //Opening brackets to execute function.
   Time[playerid]=0;  //After 15 mins, player will be able to rob because his Time array is set to 0.
   return 1; //returning function.
} //Closing brackets
Sorry if mistakes, its not tested.
Reply
#3

actualy there is 5 errors btw thanks +rep but i need so all shops can be robbed its gona be HUGE THANKS AND REP but this is too good +rep if anyone can make all shops in lv HUGE THANKS AND REP

EDIT:errors
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(230) : error 021: symbol already defined: "Time"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 028: invalid subscript (not an array or too many subscripts): "Time"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : warning 215: expression has no effect
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 001: expected token: ";", but found "]"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 029: invalid expression, assumed zero
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : fatal error 107: too many error messages on one line


Line:230:new Time[MAX_PLAYERS]; //Creating a variable.
Line:234:if(Time[playerid] == 1) //Detecting if the player has robbed before or not.
Reply
#4

Quote:
Originally Posted by GeTLagerLV
Посмотреть сообщение
dont be aggresive and dont say learns pawn yourself i learning dont be aggresive so thanks and help will be appreciated!
You're not even remotely trying to do something yourself. You just expect to be given everything. Give a man a fish and you feed him for a day, teach a man to fish and you feed him for a lifetime.
Reply
#5

@Lordz
You failed in making the forward
Your forward is
pawn Код:
forward disabletime() //Forwarding our timer.
But the callback is + THERE is no ';' in forward declaration
pawn Код:
public disabletime(playerid) //Creating disabletime function which we've used in the time.
So @GetLagerLV
change
pawn Код:
forward disabletime()
to
pawn Код:
forward disabletime(playerid);
Reply
#6

Try this
pawn Код:
new LTime[MAX_PLAYERS]; //Creating a variable.
//We'll use this as a time variable so as to prevent frequent robberies.

CMD:brob(playerid,params[]) //Creating the command using zcmd.
{
   if(LTime[playerid] == 1) //Detecting if the player has robbed before or not.
   { //If yes,
      SendClientMessage(playerid, 0xFF0000, "You have just done a robbery. Please wait for sometime."); //Messaging to wait for sometime for next robbery.
   } //Closing and if not robbed,
   new interior; //Creating a variable as interior.
   interior = GetPlayerInterior(playerid); //Using the variable to detect player's interior.
   if(interior == 0) //Checking whether the detected interior is 0. 0 here used is the interior id of the bank.
//You can get more id's on wiki samp.
   { //If player is in that interior.
     GivePlayerMoney(playerid,100000); //Giving player money to regard that he robbed.
     LTime[playerid]=1; //Changing the time variable to 1 so it'll be that the player has robbed.
     SendClientMessage(playerid, 0xFF0000, "You have successfully robbed a bank."); //A message to player regarding his successful robbery.
     SetTimerEx("disabletime", 900000,false,"d",playerid); //Creating a timer for 15 minutes which can disable the time variable so that the player can rob after 15 minutes.
   } //Closing the opened brackets.
   else //Using else statement to switch that if player is not in the correct interior,
   { //Opening brackets to execute function.
     SendClientMessage(playerid, 0xFF0000, "You must be in a bank to use this command."); //Giving a message that player should be in a bank to use this command.
   } //Closing the brackets.
   return 1; //Returning functions.
} //Closing command.

forward disabletime(playerid) //Forwarding our timer.

public disabletime(playerid) //Creating disabletime function which we've used in the time.
{ //Opening brackets to execute function.
   LTime[playerid]=0;  //After 15 mins, player will be able to rob because his Time array is set to 0.
   return 1; //returning function.
}
Edit:
@Jarnu,
Oh thanks for pointing it out.
Didnt see it.
Reply
#7

Thanks Jarnu i sayed all help will be thanked so +rep
Reply
#8

Ok thanks no errors but need to learn or find and learn all robbery places searching all ****** and sa-mp didnt find anything ehh
Reply
#9

@Lordz..
Again a fail sir! LOL

pawn Код:
forward disabletime(playerid) //Forwarding our timer.
again saying it need ';' or it will give you bunch of errors
it must be
pawn Код:
forward disabletime(playerid); //Forwarding our timer.
Reply
#10

Quote:
Originally Posted by GeTLagerLV
Посмотреть сообщение
actualy there is 5 errors btw thanks +rep but i need so all shops can be robbed its gona be HUGE THANKS AND REP but this is too good +rep if anyone can make all shops in lv HUGE THANKS AND REP

EDIT:errors
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(230) : error 021: symbol already defined: "Time"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 028: invalid subscript (not an array or too many subscripts): "Time"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : warning 215: expression has no effect
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 001: expected token: ";", but found "]"
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : error 029: invalid expression, assumed zero
C:\Users\qwerty\Desktop\Scratch Roleplay\gamemodes\DMRP.pwn(234) : fatal error 107: too many error messages on one line


Line:230:new Time[MAX_PLAYERS]; //Creating a variable.
Line:234:if(Time[playerid] == 1) //Detecting if the player has robbed before or not.
Learn scripting? We dont gonna make all shops for u!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)