onPickup fix, onDisconnect, docs
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6606 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -124,6 +124,9 @@ CubeScript
|
||||
[*] onKill - Native alias that is executed when a player is killed.
|
||||
[*] onFlagEvent - Native alias that is executed when a flag event occurs.
|
||||
[*] onLastMin - Native alias that is executed when the last minute of the current round is reached.
|
||||
[*] onPickup - Native alias that is executed when you pick up an item.
|
||||
[*] onWeaponSwitch - Native alias that is executed when you switch to a different weapon.
|
||||
[*] onDisconnect - Native alias that is executed when you disconnect from a server.
|
||||
[*] onReload - Native alias that is executed when you reload a weapon.
|
||||
[*] onNewMap - Native alias that is executed when you execute the /newmap command.
|
||||
[*] afterinit - Native alias that is executed immediately after saved.cfg is loaded.
|
||||
|
||||
@@ -625,7 +625,10 @@ docexample [echo $votepending] [Output: if there is currently a vote pending, re
|
||||
docident [onSpawn] [If this alias exists it will be run every time someone spawns.];
|
||||
docident [onKill] [If this alias exists it will be run every time a player is killed.];
|
||||
docident [onFlag] [If this alias exists it will be run every time a flag action occurs.];
|
||||
docident [onPickup] [If this alias exists it will be run every time you pick up an item.];
|
||||
docident [onWeaponSwitch] [If this alias exists it will be run every time you switch to a different weapon.];
|
||||
docident [onConnect] [If this alias exists it will be run every time you or another player join(s) your server.];
|
||||
docident [onDisconnect] [If this alias exists it will be run every time you disconnect from a server.];
|
||||
docident [onNameChange] [If this alias exists it will be run every time you or another player change(s) of name.];
|
||||
docident [mdldyncache] [];
|
||||
docargument [V] [] [min 1/max 32/default 2];
|
||||
|
||||
+20
-1
@@ -2034,13 +2034,32 @@ addOnLoadAlways [
|
||||
</arguments>
|
||||
<description>If defined, this will be executed each time a flag action occurs.</description>
|
||||
</scriptalias>
|
||||
|
||||
|
||||
<scriptalias name="onPickup">
|
||||
<arguments>
|
||||
<argument token="item" description="The item that was picked up" valueNotes="integer (0 = pistol clips, 1 = ammo box, 2 = grenade, 3 = health, 4 = helmet, 5 = armour, 6 = akimbo)" />
|
||||
<argument token="q" description="The quantity that was received" />
|
||||
</arguments>
|
||||
<description>If defined, this will be executed each time you pick up an item.</description>
|
||||
</scriptalias>
|
||||
|
||||
<scriptalias name="onWeaponSwitch">
|
||||
<arguments>
|
||||
<argument token="w" description="The weapon ID that you switched to" />
|
||||
</arguments>
|
||||
<description>If defined, this will be executed each time you switch to a different weapon.</description>
|
||||
</scriptalias>
|
||||
|
||||
<scriptalias name="onConnect">
|
||||
<arguments>
|
||||
<argument token="player" description="The client number of the player who connected" valueNotes="integer (-1 for local player)" />
|
||||
</arguments>
|
||||
<description>If defined, this will be executed when you or another player join(s) a server.</description>
|
||||
</scriptalias>
|
||||
|
||||
<scriptalias name="onDisconnect">
|
||||
<description>If defined, this will be executed when you disconnect from a server.</description>
|
||||
</scriptalias>
|
||||
|
||||
<scriptalias name="onSpawn">
|
||||
<arguments>
|
||||
|
||||
@@ -215,6 +215,8 @@ void disconnect(int onlyclean, int async)
|
||||
}
|
||||
#endif
|
||||
if(!onlyclean) localconnect();
|
||||
|
||||
if(identexists("onDisconnect")) execute("onDisconnect");
|
||||
}
|
||||
|
||||
void trydisconnect()
|
||||
|
||||
+12
-13
@@ -307,23 +307,23 @@ void pickupeffects(int n, playerent *d)
|
||||
if(identexists("onPickup"))
|
||||
{
|
||||
string o;
|
||||
itemstat tmp;
|
||||
itemstat *tmp = NULL;
|
||||
switch(e.type)
|
||||
{
|
||||
case I_CLIPS: tmp = ammostats[GUN_PISTOL]; break;
|
||||
case I_AMMO: tmp = ammostats[player1->primary]; break;
|
||||
case I_GRENADE: tmp = ammostats[GUN_GRENADE]; break;
|
||||
case I_AKIMBO: tmp = ammostats[GUN_AKIMBO]; break;
|
||||
case I_CLIPS: tmp = &ammostats[GUN_PISTOL]; break;
|
||||
case I_AMMO: tmp = &ammostats[player1->primary]; break;
|
||||
case I_GRENADE: tmp = &ammostats[GUN_GRENADE]; break;
|
||||
case I_AKIMBO: tmp = &ammostats[GUN_AKIMBO]; break;
|
||||
case I_HEALTH:
|
||||
case I_HELMET:
|
||||
case I_ARMOUR: tmp = powerupstats[e.type-I_HEALTH]; break;
|
||||
case I_ARMOUR: tmp = &powerupstats[e.type-I_HEALTH]; break;
|
||||
default: break;
|
||||
}
|
||||
if(m_lss && e.type == I_GRENADE)
|
||||
formatstring(o)("onPickup %d %d", e.type - 3, 2);
|
||||
else
|
||||
formatstring(o)("onPickup %d %d", e.type - 3, tmp);
|
||||
execute(o);
|
||||
if(tmp)
|
||||
{
|
||||
formatstring(o)("onPickup %d %d", e.type - 3, m_lss && e.type == I_GRENADE ? 2 : tmp->add);
|
||||
execute(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
else audiomgr.playsound(is.sound, d);
|
||||
@@ -662,5 +662,4 @@ void syncentchanges(bool force)
|
||||
}
|
||||
changedents.setsize(0);
|
||||
lastentsync = lastmillis;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user