[HELP]Drug system !
#1

Drug system

This is my nearly working Drug System that is less then 100 lines!

--- New ---
Код:
new offerweed[MAX_PLAYERS];
new haveweed[MAX_PLAYERS];
--- Commands ---
Код:
if(strcmp(cmdtext,"/givedrugs",true) == 0) {
if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREEN, "USAGE: /givedrugs [playerid/PartOfName] [amount]");
				return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GREEN, "USAGE: /givedrugs [playerid/PartOfName] [amount]");
				return 1;
			}
offerweed[giveplayerid] = 1;
GivePlayerMoney(playerid, 0 - 10);
GivePlayerMoney(playerid,10);
SendClientMessage(playerid, 0x00FF00AA, "Drugs sent");
SendClientMessage(giveplayerid, 0x00FF00AA, "Money recieved");
}
return 1;
}
if(strcmp(cmdtext, "/usedrugs", true)==0)
{
if (haveweed[playerid] < 0 || haveweed[playerid] > 999999) {

SendClientMessage(playerid, COLOR_RED, "SERVER MESSAGE: You dont have any drugs ");
return 1;
} else {
SendClientMessage(playerid,COLOR_LIGHTBLUE,"SERVER MESSAGE: You smoked drugs and you are high now!");
}
SetPlayerHealth(playerid,100);
  return 1;
}
Bugs:
-No errors at compiling
-When im on server i do /usedrugs it uses them without having them
-When i do /givedrugs is not giving.

I cant figure it out what is wrong here a little help is appreciated!
And btw... if we fix this... is free for everybody to take it

Reply
#2

jisusse bro

Take a look inside the godfather script
Then create your own

You need to use some like this

pawn Код:
if(strcmp(cmdtext, "/usedrugs", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
          if(PlayerBoxing[playerid] > 0)
        {
          SendClientMessage(playerid, COLOR_GREY, " Cant use Drugs while you are fighting !");
          return 1;
        }
            if(PlayerInfo[playerid][pDrugs] > 1)
            {
              PlayerStoned[playerid] += 1;
              if(PlayerStoned[playerid] >= 3) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); }
              new Float:PlayersArmour;
              GetPlayerArmour(playerid, PlayersArmour);
              if(PlayerInfo[playerid][pDrugPerk] > 0)
              {
                SetPlayerArmour(playerid, PlayersArmour + 10.0);
              }
              SendClientMessage(playerid, COLOR_GREY, " 2 Drug Grams used !");
              PlayerInfo[playerid][pDrugs] -= 2;
              SetPlayerArmour(playerid, PlayersArmour + 8.0);
              ApplyAnimation(playerid,"FOOD","EAT_Burger",4.1,0,0,0,0,0);
              if(STDPlayer[playerid]==1)
                {
                  STDPlayer[playerid] = 0;
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Drugs !");
                }
                else if(STDPlayer[playerid]==2)
                {
                  STDPlayer[playerid] = 1;
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Chlamydia because of the Drugs !");
                }
                else if(STDPlayer[playerid]==3)
                {
                  STDPlayer[playerid] = 2;
                  SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Gonorrhea because of the Drugs !");
                }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, " You dont have any Drug Grams left !");
            }
        }//not connected
        return 1;
    }
Reply
#3

i already have a simple drug system..if u can help me fix it?maybe u get it and test it? this can be nice drug system...i give people the change of easy drug system...
Reply
#4

pawn Код:
new offerweed[MAX_PLAYERS];
new haveweed[MAX_PLAYERS];
pawn Код:
if(!strcmp(cmd,"/givedrugs",true)) //you need to use cmd instead of cmdtext if you use strtok in it
{
    if(!IsPlayerConnected(playerid)) return 0;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
        return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /givedrugs [playerid/PartOfName] [amount]");
    giveplayerid = strval(tmp);
    if(!IsPlayerConnect(giveplayerid))
        return SendClientMessage(playerid, COLOR_GREEN, "ERROR: Invalid Playerid");
    GivePlayerMoney(playerid, - 10);
    SendClientMessage(playerid, 0x00FF00AA, "Drugs sent");
    offerweed[giveplayerid] = 1;
    GivePlayerMoney(giveplayerid,10);
    SendClientMessage(giveplayerid, 0x00FF00AA, "Money recieved");
    return 1;
}
pawn Код:
if(!strcmp(cmdtext, "/usedrugs", true))
{
    if (haveweed[playerid] <= 0 || haveweed[playerid] => 999999) //maybe it didnt worked because you had made < 0 and this is -1,-2...
        return SendClientMessage(playerid, COLOR_RED, "SERVER MESSAGE: You dont have any drugs ");
    else SendClientMessage(playerid,COLOR_LIGHTBLUE,"SERVER MESSAGE: You smoked drugs and you are high now!");
    SetPlayerHealth(playerid,100);
    return 1;
}
Hope could have in the last minutes I am here
Reply
#5

i always said u the best nero :P



Thanks
Reply
#6

Why do u need this?
Код:
if(!IsPlayerConnected(playerid)) return 0;
How can a player enter the command if he isn't connected?

And maybe i'm wrong, but doesn't the player who gives the drugs should get money and the receiver pay?
In what u wrote its the other way around..
Also, dont u wanna check first if the player has 10$ so he wont get a minus?
Maybe i'm wrong here cuz i dont know how the system should be..
Reply
#7

it does give and receive money..
i will add animation at /usedrugs ..
but this is the basic .. i will do it for my own :P
Reply
#8

http://forum.sa-mp.com/index.php?top...msg1071206#new
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)