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?
gettedbomb -> 0;
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);
Post your code...
Very easy just make some changes in Offerdrugs and then that will work for you
To player
gettedbomb <-array(GetMaxPlayers(),0);
To server
gettedbomb -> 0;
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);
}
}
}
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(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi60.tinypic.com%2F2znxtgo.png&hash=4b46f3a86a97881a9d5665395260055d3eef5371)
now it saying planted does not exist
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 .
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 :)
i also add in playerstats planted = false; but it again saying planted does not exist
now what i have to do?
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 .
there is no error it just say in console planted does not exist
That is an error... Post a screenshot along with the line numbers the error refers to.
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi62.tinypic.com%2F4sgnxz.png&hash=abc7087e5cba0261d96f3c8027ba90d4dc2920eb)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi60.tinypic.com%2Ft026qh.png&hash=e45734fbcef57abd11b2a09ad2fb4e58b72ac517)
I've Updated the system try now it will work ;) CHECK (http://forum.vc-mp.org/?topic=385.msg2417#msg2417)
thnx bro you help again