Drug System

Started by Pietersen, Mar 10, 2015, 03:35 PM

Previous topic - Next topic

Pietersen

Hello I Create a New System of Drug System but i am facing problem this is my system
my this line not works

 else if ( cmd == "buydrugs" )
{
This Lines not work nothing show directly it goes in next lineif( offerdrugs == false ) ePrivMessage( "No one offer drugs to you", player );
else if ( player.Cash < 250 ) ePrivMessage( "You need $250 to buy drugs or goto store to buy it!", player );
else
{
     BuyDrugs( player )
    ePrivMessage( "You have buy drugs from " + player.Name + " ", player );
}
}



This is Function

       function offerdrugs( player )
{
    if( offerdrugs == false ) ePrivMessage( "No one offer drugs to you", player );
    if( offerdrugs == true ) ePrivMessage( "Buy Drugs " + player.Name + ".", player);
}



And this on Playerstats
offerdrugs = false;




How can i set that line







2. Well if you help me in upper situation then there is another problem if some one buy drug from someone the buyer cash will decrease but how can i increases a drugdealer money



.

Quote from: Finch on Mar 10, 2015, 04:55 PMS.L.C i also have these same problems i dont know code to set them
But what are the errors? The message. That's what I'm interested. Without the message or a clear walk-through of what's happening we can't tell what causes it.

Let me put this in simple therms. Do you know how my house looks inside if you've never seen it or I've never described it to you?
.

Thijn

Removed insulting posts. Be nice to each other even if someone isn't as smart as you would want.

.

#3
Quote from: Thijn on Mar 10, 2015, 06:02 PMRemoved insulting posts.

Off: I was actually counting on that. Some of us (including me) just couldn't hold that rage in place anymore. I'm sorry for any caused problems but sometimes I find his behavior even more insulting than what we end up saying to him.
.

Sebastian

#4
First of all, that offerdrugs needs to be different for every player, so define it as an array, in the top of scripts:
offerdrugs <- array( GetMaxPlayers(), null );

Then you set it 0 when a player's join, to reset it's status:
offerdrugs[ player.ID ] = 0;

And, whenever you want to check if it has a specified value or not, do it like this:
if( offerdrugs[ player.ID] == 0 ) MessagePlayer( "Error - None offered you drugs...", player );




EDIT: Actually, that seems to be added to a class, but you didn't check it like that.
Show us your PlayerStats.

Thijn

Quote from: S.L.C on Mar 10, 2015, 06:05 PM
Quote from: Thijn on Mar 10, 2015, 06:02 PMRemoved insulting posts.

Off: I was actually counting on that. Some of us (including me) just couldn't hold that rage in place anymore. I'm sorry for any cause problems but sometimes I find his behavior even more insulting than what we end up saying to him.
While I agree with you, I just felt we would need to behave nice to each other since we're not helping anyone if we start flaming. I believe things like this wont happen again since I will be removing topics that break the rules and don't follow the standards regarding creating a topic about an error.

MacTavish

Well doing wrong, actually it will be like this
if( status[player.ID].offerdrugs == false )
Instead of if( offerdrugs == false ) Everywhere in the code

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

Retired VC:MP Player/Scripter :P

rww

Quote from: Beztone on Mar 11, 2015, 05:38 AMWell doing wrong, actually it will be like this
if( status[player.ID].offerdrugs == false )
Instead of if( offerdrugs == false ) Everywhere in the code

or

if (!status[player.ID].offerdrugs)
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

Finch

well it is my system not of u PysChO_Killer

thnx seby and rathore but seby your line that i have to add on playerjoin it is probably bugged i check it when i remove it then it work fines but i need help in another thing how to inc cash of druger who offer drugs it just decrease cash of buyer but not increase of drugdelar
Beztone is a scripter but he is too stupid

DizzasTeR

Quote from: Finch on Mar 12, 2015, 04:30 AMthnx seby and rathore but seby your line that i have to add on playerjoin it is probably bugged i check it when i remove it then it work fines but i need help in another thing how to inc cash of druger who offer drugs it just decrease cash of buyer but not increase of drugdelar

So i guess I was right that you are psycho killer, just use your old acc rather than using different, we know you didn't leave.

Finch

#10
what ur mean?  i am Pyschokiller? i dont need to be mansion this well it is my system not of u PysChO_Killer

Coz Every One know he has solen my function and i also post it on forum and it removed now

Beztone is a scripter but he is too stupid

Finch

another problem when i type /buydrugs it say none offer you drug and when i type /offerdrugs 0 and type /buydrugs it also said none offer you drugs maybe something went wrong on playerstats i add this on it offerdrugs = 0;
and this is line on command buy drug
if( status[player.ID].offerdrugs == 0 ) MessagePlayer( "Error - None offered you drugs...", player );
Beztone is a scripter but he is too stupid

MacTavish

First thing 0 = nagative
1 = Positive

false is nagative
true is positive

Second : Did u actually made any offerdrug cmd?  ???

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

Retired VC:MP Player/Scripter :P

Finch

yes this is offer drug cmd

else if ( cmd == "offerdrugs" )
{
     if ( status[ player.ID ].IsReg == false ) ePrivMessage( "[Error] - You are Not Registered!", player );
  else if ( !player ) MessagePlayer( "[Error] - Unknown player.", player );
   else if ( !text ) MessagePlayer( "[Error] - Type /offerdrugs Player.", player );
     else if ( status[ player.ID ].IsLogged == false ) ePrivMessage( "[Error] - You're Not Login!", player );
else
{
          Message( " " + player.Name + " is offering drugs to " + player.Name + "." );
}
}
Beztone is a scripter but he is too stupid

MacTavish

#14
Lol you've changed some lines of login cmd to work for you as offerdrugs

if( cmd == "od" )
{
if ( !text ) MessagePlayer("Syntax - /od Nick/ID",player);
else if ( !player.IsSpawned ) MessagePlayer("You Have'nt Spawned Yet!",player);
else
{
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer(" Unknown Player ",player);
else if ( !plr.IsSpawned ) MessagePlayer(" "+plr.Name+" Has'nt Spawned Yet!",player);
else if ( plr.Cash < 250 ) MessagePlayer(" "+plr.Name+" Not Have Enough Money",player);
else
{
MessagePlayer(" "+player.Name+" Has offer drugs to you",plr);
status[plr.ID].offerdrugs = true;
IncCash( player, 250 );
DecCash( plr, 250 );
MessagePlayer("You've offered drugs to "+plr.Name+" ",player);
}
}
}


The code is'nt tested because i wrote from mobile


else if ( cmd == "buydrugs" )
{
if( status[player.ID].offerdrugs == false ) ePrivMessage( "No one offer drugs to you", player );
else if ( player.Cash < 250 ) ePrivMessage( "You need $250 to buy drugs or goto store to buy it!", player );
else
{
     BuyDrugs( player );
    ePrivMessage( "You have buy drugs from " + player.Name + " ", player );
}
}


And put this in your buy drug function
status[player.ID].offerdrugs = false;

UPDATE

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

Retired VC:MP Player/Scripter :P