Initial Commit
Initial Commit
This commit is contained in:
82
_module/nss/mpoker_discard.nss
Normal file
82
_module/nss/mpoker_discard.nss
Normal file
@@ -0,0 +1,82 @@
|
||||
#include "x4_inc_functions"
|
||||
#include "mpoker_include"
|
||||
int StartingConditional()
|
||||
{
|
||||
object oStool1 = GetNearestObjectByTag("mpoker_stool1");
|
||||
object oStool2 = GetNearestObjectByTag("mpoker_stool2");
|
||||
|
||||
object oP1 = GetSittingCreature(oStool1);
|
||||
object oP2 = GetSittingCreature(oStool2);
|
||||
|
||||
SetLocalObject(OBJECT_SELF, "oP1", oP1);
|
||||
SetLocalObject(OBJECT_SELF, "oP2", oP2);
|
||||
|
||||
if (GetLocalInt(OBJECT_SELF, "STAGE") == 4)
|
||||
{
|
||||
//Get the current PC
|
||||
string sCurrent = GetLocalString(OBJECT_SELF, "CURRENT");
|
||||
object oPlayer = GetLocalObject(OBJECT_SELF, sCurrent);
|
||||
|
||||
//Set token
|
||||
SetCustomToken(916, GetName(oPlayer));
|
||||
|
||||
//Retrieve PC's message
|
||||
string sMessage = GetLocalString(OBJECT_SELF, "SPOKEN");
|
||||
if (sMessage == "#1" || sMessage == "#2" || sMessage == "#3" || sMessage == "#4" || sMessage == "#5")
|
||||
{
|
||||
int nReturn = FALSE;
|
||||
if (sMessage == "#1")
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_1") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_1", 1);
|
||||
nReturn = TRUE;
|
||||
}
|
||||
}
|
||||
if (sMessage == "#2")
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_2") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_2", 1);
|
||||
nReturn = TRUE;
|
||||
}
|
||||
}
|
||||
if (sMessage == "#3")
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_3") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_3", 1);
|
||||
nReturn = TRUE;
|
||||
}
|
||||
}
|
||||
if (sMessage == "#4")
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_4") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_4", 1);
|
||||
nReturn = TRUE;
|
||||
}
|
||||
}
|
||||
if (sMessage == "#5")
|
||||
{
|
||||
if (GetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_5") == 0)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "PLAYER1_DISCARD_5", 1);
|
||||
nReturn = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (nReturn == FALSE) return FALSE;
|
||||
|
||||
//Show hands
|
||||
SendMessageToPC(oPlayer, "The pot is: " + IntToString(GetLocalInt(OBJECT_SELF, "POT")));
|
||||
SendMessageToPC(oPlayer, ShowMHandAndScores("PLAYER1"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
Reference in New Issue
Block a user