SA-MP Forums Archive
using SetPlayerDrunkLevel - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: using SetPlayerDrunkLevel (/showthread.php?tid=95246)



using SetPlayerDrunkLevel - Hiitch - 03.09.2009

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?


Re: using SetPlayerDrunkLevel - JaTochNietDan - 03.09.2009

Is cmd correctly defined?

Try using cmdtext instead of cmd.

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


Re: using SetPlayerDrunkLevel - Hiitch - 03.09.2009

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*


Re: using SetPlayerDrunkLevel - BP13 - 03.09.2009

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


Re: using SetPlayerDrunkLevel - JaTochNietDan - 03.09.2009

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.


Re: using SetPlayerDrunkLevel - hipy - 03.09.2009

yes works. its very weird you cant drive straigt


Re: using SetPlayerDrunkLevel - lavamike - 03.09.2009

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


Re: using SetPlayerDrunkLevel - Whiteagle - 03.09.2009

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


Re: using SetPlayerDrunkLevel - lavamike - 03.09.2009

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