| Blockland Forums > Modification Help |
| Making a package? |
| (1/3) > >> |
| tyler0:
Ok i am doing a little test but it seems there is something wrong. All i want to do is when you plant a brick it sends a message to all players saying "Hey". Copied this code from CashmodII: --- Code: ---package CashPackage } function fxDTSbrick::Plant(%brick) { %e = Parent::Plant(%brick); if(!%e) { %c = getbrickgroupfromobject(%brick).client; if(isObject(%c) && isObject(%c.player) && isObject(%c.player.tempbrick)) { %vol = %c.player.tempbrick.getVolume(); %cost = $Cash::BrickCostPerVolume / 10; %amt = mFloatLength(%c.cashObj.cash,2); if(%amt < %cost * %vol) { commandtoclient(%c,'centerprint',"\c6You need" SPC CashStr(%cost * %vol,"") SPC "\c6to plant this brick.",2); %brick.schedule(0,"delete"); } else { %c.cashObj.mod("Cash",0 - (%cost * %vol)); } } } } }; ActivatePackage(CashPackage); --- End code --- This is my server.cs: --- Code: ---Package Test { function fxDTSbrick::Plant(%brick) { %e = Parent::Plant(%brick); if(!%e) { MessageAll('', "Hey"); } } }; ActivatePackage(Test); --- End code --- |
| Makingblah:
Ok, I'm not that knowledgeable, but shouldn't your server.cs have: --- Code: ---exec("./otherfilenamehere.cs"); --- End code --- at the end or something? |
| DrenDran:
--- Quote from: tyler0 on July 09, 2010, 01:48:43 PM ---Ok i am doing a little test but it seems there is something wrong. All i want to do is when you plant a brick it sends a message to all players saying "Hey". Copied this code from CashmodII: -snip- This is my server.cs: --- Code: ---Package Test { function fxDTSbrick::Plant(%brick) { %e = Parent::Plant(%brick); if(!%e) { MessageAll('', "Hey"); } } }; ActivatePackage(Test); --- End code --- --- End quote --- Take the %e out completly. Like this: --- Code: ---package test { function fxDTSbrick::Plant(%brick) { %e = Parent::Plant(%brick); MessageAll('', "Hey"); } }; activatepackage(test); --- End code --- |
| tyler0:
--- Quote from: DrenDran on July 09, 2010, 05:27:43 PM ---Take the %e out completly. Like this: --- Code: ---package test { function fxDTSbrick::Plant(%brick) { %e = Parent::Plant(%brick); MessageAll('', "Hey"); } }; activatepackage(test); --- End code --- --- End quote --- Tried it but didn't work... :( |
| Crysist:
Well... Now you have no use for %e, also, I think you have to return the parent. Like this --- Code: ---package test { function fxDTSbrick::Plant(%brick) { return Parent::Plant(%brick); MessageAll('', "Hey"); } }; activatepackage(test); --- End code --- |
| Navigation |
| Message Index |
| Next page |