16.01.2017, 19:54
Hello, How to i can add Chance for Robbery 1/2 Chance? Please help me... im creating the command but i want to know how to create a change of rob
help or give me a tutoiral of how to make change of robbing
Код:
CMD:robbery(playerid, params[])
{
if(!IsPlayerInDynamicCP(playerid, CP_Warehouse)) return SendClientMessage(playerid, COLOR_RED,"You are not in a Warehouse Checkpoint!!");
{
if(Warehouserobbedrecently >=1) //checking if WArehouse has been robbed recently
{
SendClientMessage(playerid, COLOR_RED, "[ROBBERY]: Warehouse has been robbed recently"); // sending error message
}
ROBBING_Warehouse[playerid] = 60; // setting the robbery timer
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) +5);
Warehouserobbedrecently =200; // Time the players needs to wait for starting an another robbery in the same place
}
return 1;
}
forward ServerRobbery();
public ServerRobbery()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) // checking if player connected
{
//ROBBERIES
if(ROBBING_Warehouse[i] > 1) // Checking if robbery time is above 1
{
ROBBING_Warehouse[i] --; // Decreasing time
new time[20]; //adding time variable
format(time,sizeof(time),"~b~Robbery Time:%d",ROBBING_Warehouse[i]);
SetPlayerWantedLevel(i, GetPlayerWantedLevel(i) + 4); //giving player 4 wanted level
GameTextForPlayer(i,time,500,3); //shows gametext showing the time remaining for the robbery
}
if(ROBBING_Warehouse[i] == 1) // IF the timer reached 1
{
new string[64], pName[MAX_PLAYER_NAME];// getting player name
GetPlayerName(i,pName,MAX_PLAYER_NAME);
SendClientMessage(i, COLOR_GREEN, "Robbery Complete"); //sending message to the player that robbery was complete
ROBBING_Warehouse[i] =0; // RESET timer
new mrand =random(200000);
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed a total of $%d from Warehouse!",pName,i,mrand);
SendClientMessageToAll(COLOR_RED,string);
GivePlayerMoney(i, mrand);
}
}
}
return 1;
}


