Countdown Robbery cd
#1

Hello Guys i search for Countdown Robbery i mean

1 - 10 Secdons When A Player Robbing Store Or Bank Or Casino i send a Code Robred


Код:
CMD:robred(playerid, params[])
{
	if(GetTeam{playerid} != CLASS_CIV) return SendClientMessage(playerid, RED, "Only civilians can rob places.");
	if(IsRobbingRedsands{playerid} == true) return SendClientMessage(playerid, RED, "Your already robbing the joint.");
	if(IsPlayerHoldingAGun(playerid) == 0 || HasBeenCuffed{playerid} == true) return SendClientMessage(playerid, RED, "You must be holding a gun to rob places.");
    if((gettime() - 120) < TimerInfo[playerid][CMD_timer18]) return SendClientMessage(playerid, RED, "Please wait before using this command again.");
    TimerInfo[playerid][CMD_timer18] = gettime();
	new chance = random(3);
	if(chance == 0)
	{
	    format(fstr, sizeof(fstr),  "[DISPATCH]: Suspect %s [%d] has attempted to rob the Redsands Casino at Redsands West.", GetName(playerid), playerid);
        CopRadio(BLUE, fstr);
        SendClientMessage(playerid, RED, "You have failed to rob the Redsands Casino.");
	    GameTextForPlayer(playerid, "~w~Robbery ~r~Failed", 5000, 5);
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
	}
	else if(GetPlayerVirtualWorld(playerid) == 3 && IsPlayerInRangeOfPoint(playerid,1.0,1139.7198,-4.0644,1000.6719))
    {
	    if((gettime() - 120) < redrobbed) return SendClientMessage(playerid, RED, "This place has been robbed recently, try again later.");
        format(fstr, sizeof(fstr), "[DISPATCH]: Suspect %s [%d] is now robbing the Redsands Casino at Redsands West.", GetName(playerid), playerid);
        CopRadio(BLUE, fstr);
        SendClientMessage(playerid, LIGHTGREEN, "Your robbing the Redsands Casino, DON'T LEAVE THE CHECKPOINT!");
	    GameTextForPlayer(playerid, "~r~Holdup ~w~In ~g~Progress...~n~~r~Dont Leave ~w~The ~r~Checkpoint.", 25000, 5);
        IsRobbingRedsands{playerid} = true;
        SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)+6);
        redsandstimer{playerid} = SetTimerEx("RedsandsRob", 25000, false, "d", playerid);
        ApplyAnimation(playerid,"ped","ARRESTgun",4.1,0,1,1,1,1);
        redrobbed = gettime();
        new cash = random(130000);
        GivePlayerMoney(playerid, cash);
	}
	else
	{
        SendClientMessage(playerid, RED, "Your not at the robbery checkpoint.");
	}
	new astring[100],pName[24];
	GetPlayerName(playerid,(pName),sizeof(pName));
    format(astring,sizeof(astring),"%s [%d] typed: /robred",pName,playerid);
    SendAdminMessage(GREY,astring);
    new cash = random(100000);
    GivePlayerMoney(playerid, cash);
	return true;
}
So How to i can add Timer / Countdown When Player Robbing it ?
Reply
#2

Simply by adding something like this:

(Just giving example):

PHP код:
new timerseconds;
seconds 10;
SetTimerEx("Robbing" 1000true"id"playeridseconds);
forward Robbing(playeridseconds);
public 
Robbing(playeridseconds)
{
new 
string[128]
if(
seconds == 0)
SendClientMessage(playeridCOLORID_HERE"You have robbed the bank successfully!");
else
{
format(stringsizeof(string), "%d Remaining"seconds);
SendClientMessage(playeridCOLORID_HEREstring);
seconds seconds 1;

Simple as that..

Rep++ if I helped you bro I would be really thankful.
Reply
#3

i try to do it its given me Many Erros
Reply
#4

Ah.. damn. I just gave an example. You must code the rest by yourself, and make it fit in your gamemode.
Reply
#5

Quote:
Originally Posted by Akbaig
Посмотреть сообщение
Ah.. damn. I just gave an example. You must code the rest by yourself, and make it fit in your gamemode.
oh its okay
Reply
#6

how i can make it only for civilian
Reply


Forum Jump:


Users browsing this thread: