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
dont be aggresive and dont say learns pawn yourself i learning dont be aggresive so thanks and help will be appreciated!
|
forward disabletime() //Forwarding our timer.
public disabletime(playerid) //Creating disabletime function which we've used in the time.
forward disabletime()
forward disabletime(playerid);
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.
}
forward disabletime(playerid) //Forwarding our timer.
forward disabletime(playerid); //Forwarding our timer.
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. |