using SetPlayerDrunkLevel
#1

Hey, I'm having this problem with the SetPlayerDrunkLevel

if I make a command called /drunkon and I type that ingame, how come it doesnt work? it always says "Server : Unknown command"

This is what I did

pawn Код:
if (strcmp(cmd, "/drunkon", true) == 0)
{
    SetPlayerDrunkLevel(playerid, 3000);
    SendClientMessage(playerid, 0xFFAAAAAA, "You are now drunk !");
    return 1;
}
Is there anything I am missing from this? Or does it not work yet properly since it is still in beta?
Reply
#2

Is cmd correctly defined?

Try using cmdtext instead of cmd.

As that code looks fine and DrunkLevel's have been tested.
Reply
#3

Well the thing is I ran a test with using cmd

>> cmd = strtok(cmdtext, idx);

and one test with cmdtext

>> Code alerady defined in the script

And I guess my conclusion would have to be that SetPlayerDrunkLevel may not be made just yet, but has a native function then. Oh well. *waits*
Reply
#4

for the drunk level, what is a average number for high drunkness?
Reply
#5

Quote:
Originally Posted by Hiitch[WS
- WestSide Servers ]
Well the thing is I ran a test with using cmd

>> cmd = strtok(cmdtext, idx);

and one test with cmdtext

>> Code alerady defined in the script

And I guess my conclusion would have to be that SetPlayerDrunkLevel may not be made just yet, but has a native function then. Oh well. *waits*
It actually does work, as said already I've tested it.

Besides "Unknown Command" doesn't mean a function is invalid, it clearly means the script doesn't recognize that you've input a command which is in the script.
Reply
#6

yes works. its very weird you cant drive straigt
Reply
#7

It works, i tried doing what you were doing but got mad at strcmp so I just used DCMD..

pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1

//-------------------------------------------------
dcmd_drink(playerid, params[])
{
  if(!strlen(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "Error: You did not submit a number.");
  SetPlayerDrunkLevel(playerid, strval(params));
  SendClientMessage(playerid, 0xFFFFFFAA, "You are now drunk, don't drink and drive!");
  return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(drink,5,cmdtext);
}

with that you can do /drink number and it will set your drunk level to the number

so /drink 3000
Reply
#8

What about

Код:
if (strcmp(cmd, "/givemeadrink", true) == 0)
{
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
    SendClientMessage(playerid, 0xFF0000FF, "Warning: If you drink, dont drive!!");
    return 1;
}
And then drink the times you want, it's funnier & interactive
Reply
#9

Quote:
Originally Posted by Whiteagle
And then drink the times you want, it's funnier & interactive
Maybe funner but you can do /drink 50000

the max drunk level, think about how many drinks to get 50000 :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)