MP script question.
Moderator: Moderators
MP script question.
can you store keys in individual players? for example, local.player.coolness = 5 ? would that work? and would it stay persistanct across rounds?
- The Jackal
- Sergeant Major
- Posts: 101
- Joined: Wed May 07, 2003 10:09 am
- Contact:
OK this thread comes the closest to what I am looking for.
Setup the question:
OK I am makin a "No Cross" script. It kills the player that tries to cross. But this just mean that a suicidal player can continue killing himself and ruining the score. I saw that you can add a key to a player.
The Question:
Can I change that key and refer to it ( like I would a CVAR) each time the player crosses?
The Script:
Am I on the right road? Because this sure do not work! 
Setup the question:
OK I am makin a "No Cross" script. It kills the player that tries to cross. But this just mean that a suicidal player can continue killing himself and ruining the score. I saw that you can add a key to a player.
The Question:
Can I change that key and refer to it ( like I would a CVAR) each time the player crosses?
The Script:
Code: Select all
_border:
while(1)
{
$player[local.p].warn = ""
for(local.p = 1; local.p < $player.size+1;local.p++)
{
if($player[local.p].origin[1] <= 1200 && $player[local.p].warn == "")
{
$player[local.p] hurt 200
$player[local.p].warn = "1"
$player[local.p] iprintln "This is your first warning...."
}
if($player[local.p].origin[1] <= 1200 && $player[local.p].warn == "1")
{
$player[local.p] hurt 200
$player[local.p].warn = "2"
$player[local.p] iprintln "This is your FINAL warning...."
}
if($player[local.p].origin[1] <= 1200 && $player[local.p].warn == "2")
{
$player[local.p] hurt 200
wait .5
$player[local.p] stufftext ("say I cannot follow rules. Goodbye!")
wait 1
$player[local.p] stufftext ("disconnect")
}
else
{
// Just in case
}
}
wait (.1)
}
end-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
you need no for loop as you know who's crossing the line by the co-ordinates, so just have a trigger_multiple instead of if .origin[1] > 1200
if ((parm.other.warning == "NIL") || (parm.other.warning == 0)) // the trigger hasn't been here yet
{parm.other.warning = 1
parm.other hurt 200
wait 2} //gives him time to leave
if (parm.other.warning == 1)
{parm.other.warning = 2
parm.other hurt 200
wait 2}
if (parm.other.warning == 2)
{parm.other.warning = 3
parm.other hurt 200
wait 2}
if (parm.other.warning == 3)
{parm.other.warning = 0
parm.other stufftext "disconnect"
wait .1}
if ((parm.other.warning == "NIL") || (parm.other.warning == 0)) // the trigger hasn't been here yet
{parm.other.warning = 1
parm.other hurt 200
wait 2} //gives him time to leave
if (parm.other.warning == 1)
{parm.other.warning = 2
parm.other hurt 200
wait 2}
if (parm.other.warning == 2)
{parm.other.warning = 3
parm.other hurt 200
wait 2}
if (parm.other.warning == 3)
{parm.other.warning = 0
parm.other stufftext "disconnect"
wait .1}
hope this helps, prob not cos it's all foreign 2 me :-/
- The Jackal
- Sergeant Major
- Posts: 101
- Joined: Wed May 07, 2003 10:09 am
- Contact:
- The Jackal
- Sergeant Major
- Posts: 101
- Joined: Wed May 07, 2003 10:09 am
- Contact:
game
There is an alternative to using "local" or "level". It is "game" and it will hold across rounds, I think.
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
i've noticed that with game it only carries variables stored if the current map has a next map to load,
if it didn't there'd be god knows how many variables floating about in the game,
i'm not sure aobut roundbased games though, it seems logical to have it available to use there but never tried it myself
if it didn't there'd be god knows how many variables floating about in the game,
i'm not sure aobut roundbased games though, it seems logical to have it available to use there but never tried it myself
hope this helps, prob not cos it's all foreign 2 me :-/

