Bomb System

Started by Finch, Mar 13, 2015, 03:45 PM

Previous topic - Next topic

Finch

Well i am facing problem like i face in offerdrugs i add buybomb and plantbomb command but in playerstats there is gettedbomb = 0;

when i buybomb and type /plantbomb t say in console gettedbomb does not exist
Problem?
Beztone is a scripter but he is too stupid

MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Sk

#2
Quote from: MatheuS on Mar 13, 2015, 05:10 PMgettedbomb -> 0;
WTH
its like this
gettedbomb<-0;and if playerstats is a class then you have to use it something like this.
SomeArrayOnTop[player.ID].gettedbomb = 1;and that SomeArrayOnTop will be something like this on event onScriptLoad().
SomeArrayOnTop<-array(GetMaxPlayers(),null);

Thijn


MacTavish

Very easy just make some changes in Offerdrugs and then that will work for you

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

MatheuS

To player
gettedbomb <-array(GetMaxPlayers(),0);
To server

gettedbomb -> 0;
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Finch

else if ( cmd == "plantbomb" )
{
if ( status[player.ID].IsReg == false ) ePrivMessage( "[Error] - You Didnt Registered!", player );
else if ( status[player.ID].IsLogged == false ) ePrivMessage( "[Error] - You didnt Loggin!", player );
if  ( [player.ID].gettedbomb == 1 )
{
 if ( planted == false)
{
                              ClientMessage("You Have Planted The Bomb And It Will Expord in 15 Seconds",player,255,255,0);
                              X=player.Pos;
                              Z=player.Pos;
                              by=player.Name;
                              planted = true;
                              NewTimer("explode",15000,1,player.ID);
}
}   
}                                                       
Beztone is a scripter but he is too stupid

MacTavish

#7
Quote from: Finch on Mar 14, 2015, 04:12 AMelse if ( cmd == "plantbomb" )
{
if ( status[player.ID].IsReg == false ) ePrivMessage( "[Error] - You Didnt Registered!", player );
else if ( status[player.ID].IsLogged == false ) ePrivMessage( "[Error] - You didnt Loggin!", player );
if  ( [player.ID].gettedbomb == 1 )
{
 if ( planted == false)
{
ClientMessage("You Have Planted The Bomb And It Will Expord in 15 Seconds",player,255,255,0);
X=player.Pos;
Z=player.Pos;
by=player.Name;
planted = true;
 NewTimer("explode",15000,1,player.ID);
}
}   
}                                                       

It may be like this never tried

else if ( cmd == "plantbomb" )
{
if ( status[player.ID].IsReg == false ) ePrivMessage( "[Error] - You Didnt Registered!", player );
else if ( status[player.ID].IsLogged == false ) ePrivMessage( "[Error] - You didnt Loggin!", player );
else if  (status[player.ID].gettedbomb == false) ePrivMessage( "[Error] - You Haven't Bought Bomb!", player );
else
{
ClientMessage("You Have Planted The Bomb And It Will Explode in 15 Seconds",player,255,255,0);
local  x=player.Pos.x, y= player.Pos.y, z=player.Pos.z, planter=player.ID;
  NewTimer("explode",15000,1,x, y, z, planter);
Announce(" Run Away Or Die",player,6);
status[player.ID].gettedbomb = false;
}
}   

else if ( cmd == "buybomb" )
{
if ( status[player.ID].IsReg == false ) ePrivMessage( "[Error] - You Didnt Registered!", player );
else if (player.Cash < 300 ) ePrivMessage( "[Error] - Not Enough Cash To Buy Bomb", player );
else if ( status[player.ID].IsLogged == false ) ePrivMessage( "[Error] - You didnt Loggin!", player );
else if (status[player.ID].gettedbomb == true) ePrivMessage( "[Error] - You Already Bought An Bomb!", player );
else
{
ClientMessage("You Have Bought An Bomb Place Anywhere To Explode",player,255,255,0);
status[player.ID].gettedbomb = true;
DecCash(player, 300);
}
}                     

Timer
function explode(x, y, z, planter)
{
CreateExplosion( 0, 6, x, y, z, planter, true );
AnnounceAll(" BooM, The Bome has been exploded",6);
}

Add in class
class PlayerStats
{
gettedbomb = false;
}

TESTED ;)

TRY NOW REMOVE OLD COMMANDS CLASSES AND FUNCTION


Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Finch

now it saying planted does not exist
Beztone is a scripter but he is too stupid

Kratos_


Quote from: Finch on Mar 14, 2015, 08:27 AMnow it saying planted does not exist

It says line number too . Post the console screenshot with the specific line causing the error . Make sure that you have added planted on class PlayerStats cuz his code works fine except he isn't setting gettedbomb to 0 after bomb has been exploded .

In the middle of chaos , lies opportunity.

MacTavish

#10
Quote from: Kratos_ on Mar 14, 2015, 01:55 PMexcept he isn't setting gettedbomb to 0 after bomb has been exploded .

Thanks for pointing out kratos gettedbomb added :)

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Finch

i also add in playerstats planted = false; but it again saying planted does not exist
Beztone is a scripter but he is too stupid

Finch

now what i have to do?
Beztone is a scripter but he is too stupid

MacTavish

Quote from: Kratos_ on Mar 14, 2015, 01:55 PMIt says line number too . Post the console screenshot with the specific line causing the error .

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Finch

there is no error it just say in console planted does not exist
Beztone is a scripter but he is too stupid