06-29-2011, 15:46
Hello all,
Very new to this modding deal, however I am a developer but on the php side of things. My main problem I'm seeing is knowing the function names and understanding threads. Thanks to all the great mods already released here I'm starting to learn.
So to do my first "basic" mod, I thought about doing something similar to gungame, but I'm getting stuck. Here is my code at the moment:
So here I'm trying to switch the gun based on the gun you had when you died. But it always goes back to the gun you originally picked as your kit and not what I change it to. And I'm also not sure this is the best way to do it.
What I would like to know is what are the functions/properties for determining how many deaths you have upon spawn. Can anyone help? Also sorry for being long winded lol.
Very new to this modding deal, however I am a developer but on the php side of things. My main problem I'm seeing is knowing the function names and understanding threads. Thanks to all the great mods already released here I'm starting to learn.
So to do my first "basic" mod, I thought about doing something similar to gungame, but I'm getting stuck. Here is my code at the moment:
Code:
onPlayerSpawned()
{
self endon("disconnect");
for(;;)
{
self waittill("spawned_player");
//Pulls the return data from the changeWep() function
newwep = changeWep();
//Using the results from changeWep() as parameter, call the wepControl() function.
wepControl(newwep);
}
}
changeWep()
{
curweap = self getCurrentWeapon();
//print our "current weapon" for testing
AllClientsPrint(curweap);
switch(curweap)
{
case "commando_mp":
chweap = "enfield_mp";
break;
default:
chweap = "commando_mp";
break;
}
return chweap;
}
wepControl(weap)
{
//take away our current weapon
self takeWeapon(self getCurrentWeapon());
//give weapon choosen by wepControl()
self giveWeapon(weap);
//set our current weapon to infinte ammo
self setWeaponAmmoStock( self getCurrentWeapon(), 99 );
//switch the weapon we just gave ourself to our hand,. and PWN
self switchToWeapon(weap);
}
So here I'm trying to switch the gun based on the gun you had when you died. But it always goes back to the gun you originally picked as your kit and not what I change it to. And I'm also not sure this is the best way to do it.
What I would like to know is what are the functions/properties for determining how many deaths you have upon spawn. Can anyone help? Also sorry for being long winded lol.