Jump to content
  • 0

Problema cashbox


Fanta

Question

Problema intalnita : Cum pot scoate cashboxu ?
Ero(area / rile) / warning-(ul / urile):

 

Toate comenzile care contin cashbox.. :

====================================================================================================

#define CashboxModel 1210   // Briefcase-model
#define MinCashboxValue 500
#define MaxCashboxValue 20000

 

=====================================================================================================

new CashboxPickup;
new CashboxOwner = INVALID_PLAYER_ID;
new CashboxValue;
new Float:CashboxX;
new Float:CashboxY;
new Float:CashboxZ;
new IsCashboxPickedUp;
 
====================================================================================================
new Float:CashboxLocations[][3] =
{
{2227.74, 1516.43, 10.82},
{-724.44, 1402.81, 13.07},
{-1940.61, 1086.14, 53.09},.........
 
=====================================================================================================
 
{
if(CashboxOwner == INVALID_PLAYER_ID)
{
   if(mode == 1)
      {
       SetPlayerCheckpoint(playerid, CashboxX, CashboxY, CashboxZ, 1);
}
}
}
 
 
 
=====================================================================================================
 
 
 
if(playerid == CashboxOwner)
{
   new str[128], pName[MAX_PLAYER_NAME];
   GetPlayerPos(playerid, CashboxX, CashboxY, CashboxZ);
   GetPlayerName(playerid, pName, sizeof(pName));
   format(str, 128, "Cashbox-Owner %s (ID: %d) has left the server and droped the cashbox!", pName, playerid);
   SendClientMessageToAll(0xFFD700AA, str);
CashboxPickup = CreatePickup(1210, 3, CashboxX, CashboxY, CashboxZ);
CashboxOwner = INVALID_PLAYER_ID;
if(mode == 1)
{
       for(new i; i<MAX_PLAYERS; i++)
{
   if(IsPlayerConnected(i))
   {
    SetPlayerCheckpoint(i, CashboxX, CashboxY, CashboxZ, 1);
}
}
}
}
 
================================================================================================
 
if(playerid == CashboxOwner)
{
   new str[128], pName[MAX_PLAYER_NAME];
   GetPlayerPos(playerid, CashboxX, CashboxY, CashboxZ);
   GetPlayerName(playerid, pName, sizeof(pName));
   format(str, 128, "Cashbox-Owner %s (ID: %d) has died and droped the cashbox!", pName, playerid);
   SendClientMessageToAll(0xFFD700AA, str);
CashboxPickup = CreatePickup(1210, 3, CashboxX, CashboxY, CashboxZ);
 
CashboxOwner = INVALID_PLAYER_ID;
if(mode == 1)
{
       for(new i; i<MAX_PLAYERS; i++)
{
   if(IsPlayerConnected(i))
   {
    SetPlayerCheckpoint(i, CashboxX, CashboxY, CashboxZ, 1);
}
}
}
}
=================================================================================================
 
if(playerid == CashboxOwner)
{
   PlayerPlaySound(playerid, 1054, 0, 0, 0);
   KillTimer(DropValueTimer);
   new str[128], pName[MAX_PLAYER_NAME];
if(mode == 1)
{
    DisablePlayerCheckpoint(playerid);
}
   CashboxOwner = INVALID_PLAYER_ID;
GetPlayerName(playerid, pName, sizeof(pName));
format(str, 128, "%s (ID: %d) has delivered the cashbox and won $%d", pName, playerid, CashboxValue);
SendClientMessageToAll(0xFFD700AA, str);
GivePlayerCash(playerid, CashboxValue);
        format(str, 128, "~y~Congratulations! ~n~ You won ~n~~g~$%d", CashboxValue);
GameTextForPlayer(playerid, str, 4000, 3);
SendClientMessageToAll(0xFFD700AA, "A new game will start in 3 minutes!");
SetTimer("StartNewCashboxGame", 180000, 0);
IsGameStarted = 0;
if(IsTextdrawCreated == 1)
{
TextDrawDestroy(ValueText);
IsTextdrawCreated = 0;
}
}
 
=======================================================================================================
if(pickupid == CashboxPickup)
{
   PlayerPlaySound(playerid, 1150, 0, 0, 0);
   new str[128], pName[MAX_PLAYER_NAME];
   DestroyPickup(CashboxPickup);
   IsCashboxPickedUp = 1;
CashboxOwner = playerid;
GetPlayerName(playerid, pName, sizeof(pName));
format(str, 128, "%s (ID: %d) has picked up the cashbox! Kill him before he reaches the droplocation!", pName, playerid);
SendClientMessageToAll(0xFFD700AA, str);
if(mode == 1)
{
   for(new i; i<MAX_PLAYERS; i++)
   {
       DisablePlayerCheckpoint(i);
}
}
SetPlayerCheckpoint(playerid, DropLocation[0], DropLocation[1], DropLocation[2], 3);
}
return 1;
 
 
============================================================================================================
 
forward StartNewCashboxGame();
public StartNewCashboxGame()
{
    IsGameStarted = 1;
new str[128];
new rand = random(sizeof(CashboxLocations));
CashboxValue = MinCashboxValue+random(MaxCashboxValue-MinCashboxValue);
    CashboxPickup = CreatePickup(1210, 3, CashboxLocations[rand][0], CashboxLocations[rand][1], CashboxLocations[rand][2]);
    CashboxX = CashboxLocations[rand][0];
    CashboxY = CashboxLocations[rand][1];
    CashboxZ = CashboxLocations[rand][2];
    format(str, 128, "O noua valiza in valoare de: %d $ a fost aruncata din avion ! [/chint] ", CashboxValue);
    SendClientMessageToAll(0xFFD700AA, str);
    SendClientMessageToAll(0xFFD700AA, "Obiectivul tau este sa o gasesti si sa o zdrobesti ! !");
for(new i; i<MAX_PLAYERS; i++)
{
   if(IsPlayerConnected(i))
   {
       if(mode == 1)
{
   SetPlayerCheckpoint(i, CashboxLocations[rand][0], CashboxLocations[rand][1], CashboxLocations[rand][2], 1);
}
else if(mode == 2)
{
   SendClientMessage(i, 0x0E68CAA, "You can see this location again using /chint");
}
}
}
DropValueTimer = SetTimer("DropCashboxValue", 1000, 1);
}
 
forward DropCashboxValue();
public DropCashboxValue()
{
if(IsTextdrawCreated == 1)
{
TextDrawDestroy(ValueText);
IsTextdrawCreated = 0;
}
new TextString[40];
if(CashboxValue > 0)
{
   format(TextString, 40, "~y~CashBox: ~n~~y~$%d", CashboxValue);
}
if(CashboxValue <= 0)
{
CashboxValue = 0;
   SendClientMessageToAll(0xFFD700AA, "The cashbox has no value anymore!");
   format(TextString, 40, "~y~CashBox: ~n~~r~$%d", CashboxValue);
   KillTimer(DropValueTimer);
}
if(UseTextdraw == 1)
{
ValueText = TextDrawCreate(540, 410, TextString);
IsTextdrawCreated = 1;
TextDrawLetterSize(ValueText, 0.4, 1.2);
TextDrawSetShadow(ValueText, 0);
TextDrawUseBox(ValueText, 1);
TextDrawBoxColor(ValueText, 0x000000AA);
TextDrawShowForAll(ValueText);
}
}
 
==========================================================================================
 
 
 
 
 
 

Liniile de cod / sursa / script-ul(obligatoriu):
Imagini / Video (optional): sa_mp_001.png
Ati incercat sa rezolvati singur?: Da am incercat sa scot pe rand fiecare script ce contine cashbox dar primesc errori

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.