Posts: 316
Threads: 49
Joined: Sep 2011
Quote:
Originally Posted by pds2k12
Enable/Disable and Option1/Option2 can be optimized and in much better way, without creating 2 stock.
Easier Version
pawn Код:
stock SettingsSPPTSPP(playerid, bool:Enabled = true) { if(Enabled == true) { PositionShot[playerid] = 1; SendClientMessage(playerid, COLOR_WHITE, "INFO: You have enabled SetPlayerPosToShotPlayerPos. \nNOTE: By default you will be set to the players position when you shoot them, use /options to edit this."); Option[playerid] = 1; // DEFAULT OPTION } else if(Enabled == false) { PositionShot[playerid] = 0; SendClientMessage(playerid, COLOR_WHITE, "INFO: You have disabled SetPlayerPosToShotPlayerPos."); Option[playerid] = 0; } }
stock Option(playerid, OptionID) { switch( OptionID ) { case 1: { Option[playerid] = 1; SendClientMessage(playerid, COLOR_WHITE, "INFO: You have set SetPlayerPosToShotPlayerPos to option #0001."); } case 2: { Option[playerid] = 2; SendClientMessage(playerid, COLOR_WHITE, "INFO: You have set SetPlayerPosToShotPlayerPos to option #0002."); } } }
|
Excellent. Needed to find out how to use bools correctly, but thank you.