/usedrugs problems
#1

Quote:

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] >= 2) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); }
new Float:health;
GetPlayerHealth(playerid, health);
if(PlayerInfo[playerid][pDrugPerk] > 0)
{
new hp = 2 * PlayerInfo[playerid][pDrugPerk]; hp += 20;
SetPlayerHealth(playerid, health + hp);
}
if(CommandUsed[playerid]) return SendClientMessage(playerid, COLOR_RED, "You must wait 30secounds before using drugs again.");
{
CommandUsed[playerid] = -1; // "tab" this one too
SetTimerEx("resetCmd", 30000, 0, "i", playerid); // "tab" so it gets in the right position
}
else
{
SetPlayerHealth(playerid, health + 20.0);
}
SendClientMessage(playerid, COLOR_GREY, " 2 Drug Grams used !");
PlayerInfo[playerid][pDrugs] -= 2;
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;
}

It give me an error

Quote:

D:\FOLDER~1\FOLDER~1\ASMP\gamemode\gf.pwn(23943) : error 029: invalid expression, assumed zero

And the line is
Quote:

CommandUsed[playerid] = -1; // "tab" this one too
SetTimerEx("resetCmd", 30000, 0, "i", playerid); // "tab" so it gets in the right position
}
else
{

It give me error at else can u help me pls
Reply
#2

Try tab the "SetTimerEx"line and the "CommandUsed"line
Reply
#3

The issue is because of the if and return after it, you need to use else. Looking at your code I'm quite confused actually, here is what I think it should look like:

http://jatochnietdan.pastebin.com/m63af42cb

This makes more sense to me with what you're trying to do, not sure if its suitable to what you are trying but check it out and see.
Reply
#4

Or try 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] >= 2) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); }
       new Float:health;
       GetPlayerHealth(playerid, health);
       if(PlayerInfo[playerid][pDrugPerk] > 0)
       {
         new hp = 2 * PlayerInfo[playerid][pDrugPerk]; hp += 20;
        SetPlayerHealth(playerid, health + hp);
       }
       else
       {
         SetPlayerHealth(playerid, health + 20.0);
       }
       SendClientMessage(playerid, COLOR_GREY, "  2 Drug Grams used !");
       PlayerInfo[playerid][pDrugs] -= 2;
       if(CommandUsed[playerid]) return SendClientMessage(playerid, COLOR_RED, "You must wait 30secounds before using drugs again.");
       {
         CommandUsed[playerid] = -1; // "tab" this one too
         SetTimerEx("resetCmd", 30000, 0, "i", playerid); // "tab" so it gets in the right position
       }
       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
#5

Thx boys i solved it
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)