SHOW:
|
|
- or go back to the newest paste.
| 1 | /* | |
| 2 | DROP TABLE IF EXISTS `geworben`; | |
| 3 | CREATE TABLE `geworben` ( | |
| 4 | `account_id` int(11) NOT NULL, | |
| 5 | `friend_id` int(11) NOT NULL, | |
| 6 | `message` text NOT NULL, | |
| 7 | `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 8 | `confirmed` int(11) NOT NULL, | |
| 9 | `name` text NOT NULL, | |
| 10 | PRIMARY KEY (`account_id`) | |
| 11 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | |
| 12 | */ | |
| 13 | ||
| 14 | prontera,155,175,6 script Test 606,{
| |
| 15 | ||
| 16 | //-> .@WerberID wird Anhand der Account ID gesetzt. | |
| 17 | query_sql("select `account_id` from `login` WHERE `account_id` = " + GetCharID( 3 ), .@WerberID);
| |
| 18 | ||
| 19 | //-> Anfang für neuen Eintrag | |
| 20 | set .@npc$, "[^FF0000User werben User^000000]"; | |
| 21 | mes .@npc$; | |
| 22 | mes "Was möchtest du tun?"; | |
| 23 | if( Select( "Freund ^008800eintragen^000000", "Ich wurde^FF0000angeworben^000000", "Alle Freunde einsehen", "Beenden" ) == 4 ) | |
| 24 | close; | |
| 25 | ||
| 26 | // alle geworben Friends Auflisten | |
| 27 | if( @menu == 3 ) {
| |
| 28 | next; | |
| 29 | set .@c1, Query_SQL( "SELECT `name`, DATE_FORMAT(`time`, '%d.%m.%Y'), `confirmed` FROM `geworben` WHERE `account_id` = " + GetCharID( 3 ), .@Friend$, .@date$, .@confirmed ); | |
| 30 | if( .@c1 == 0 ) {
| |
| 31 | mes .@npc$; | |
| 32 | mes "^FF0000Derzeit sind keine Freunde im System eingetragen^000000"; | |
| 33 | close; | |
| 34 | } | |
| 35 | if( .@confirmed == 0 ) {set .@con$, "W";}
| |
| 36 | if( .@confirmed == 1 ) {set .@con$, "X";}
| |
| 37 | if( .@confirmed == 2 ) {set .@con$, "OK";}
| |
| 38 | mes "[^FF0000geworben Liste - " + .@c1 + " Accounts^000000]"; | |
| 39 | mes "[Nr] <Name> (<Datum>)"; | |
| 40 | for( set .@i, 0; .@i < .@c1; set .@i, .@i + 1 ) | |
| 41 | mes "[" + ( .@i + 1 ) + "] " + .@Friend$[ .@i ] + " (" + .@date$[ .@i ] + ") " + .@con$[ .@i ] + "";
| |
| 42 | close; | |
| 43 | } | |
| 44 | ||
| 45 | //-> Spieler suchen | |
| 46 | mes "Spieler Name?"; | |
| 47 | do {
| |
| 48 | Input( .@name$ ); | |
| 49 | set .@c, Query_Sql( "SELECT `account_id` FROM `char` WHERE `name` = '" + .@name$ + "'", .@FriendID ); | |
| 50 | next; | |
| 51 | if( .@c == 0 ) {
| |
| 52 | mes "^ff0000'" + .@name$ + "' wurde nicht gefunden!^000000"; | |
| 53 | if( Select( "nochmal eingeben", "Beenden" ) == 2 ) | |
| 54 | close; | |
| 55 | } | |
| 56 | } while( .@c < 1 ); | |
| 57 | mes .@npc$; | |
| 58 | mes "^0000FFSpieler^000000: " + .@name$ + " "; | |
| 59 | mes "wurde gefunden."; | |
| 60 | next; | |
| 61 | ||
| 62 | ||
| 63 | // Spieler hinzufügen | |
| 64 | if( @menu == 1 ) {
| |
| 65 | if( Select( "Okay, eintragen!", "Abbrechen!" ) == 2 ){
| |
| 66 | mes "^ff0000Abbruch...^000000"; | |
| 67 | close; | |
| 68 | } | |
| 69 | //-> Abfrage ob vorhanden | |
| 70 | Query_SQL( "SELECT `friend_id` FROM `geworben` WHERE `friend_id` = '" + .@FriendID + "'", .@check ); | |
| 71 | if( .@check > 0 ){ // Friend ID bereits in Table
| |
| 72 | mes "^ff0000Für diese Aktion besteht bereits eine Anfrage!^000000"; | |
| 73 | close; | |
| 74 | }else{
| |
| 75 | mes "Bitte eine Nachricht eingeben!"; | |
| 76 | Input( .@message$ ); | |
| 77 | Query_SQL( "INSERT INTO `geworben` VALUES ( " + .@WerberID + ", " + .@FriendID + ", '" + .@message$ + "', '0000-00-00 00:00:00', '0', '" + .@name$ + "' );" ); | |
| 78 | next; | |
| 79 | } | |
| 80 | } | |
| 81 | mes "^0000FFSpieler^000000: " + .@name$ + " "; | |
| 82 | mes "^0000FFNachricht^000000: " + .@message$ + " "; | |
| 83 | close; | |
| 84 | ||
| 85 | ||
| 86 | // enfernen | |
| 87 | // if( .@jCount == 0 ) {
| |
| 88 | // mes "^FF0000Der Account steht nicht im geworben!^000000"; | |
| 89 | // close; | |
| 90 | // } | |
| 91 | ||
| 92 | // if( Select( "Okay, entfernen!", "Abbrechen!" ) == 2 ){
| |
| 93 | // mes "^ff0000Abbruch...^000000"; | |
| 94 | // close; | |
| 95 | // } | |
| 96 | ||
| 97 | // Query_SQL( "DELETE FROM `geworben` WHERE account_id = " + .@AccountID ); | |
| 98 | // mes "^008800Erfolgreich entfernt!^000000"; | |
| 99 | // close; | |
| 100 | ||
| 101 | OnPCLoginEvent: | |
| 102 | if( Query_SQL( "SELECT `message`, `account_id` FROM `geworben` WHERE `friend_id` = " + GetCharID( 3 ), .@message$, .@aid ) == 0 ) | |
| 103 | end; | |
| 104 | Query_SQL( "UPDATE `geworben` SET `time` = NOW() WHERE `friend_id` = " + GetCharID( 3 ) ); | |
| 105 | ||
| 106 | mes "[^FF0000 ExRO geworben ^000000]"; | |
| 107 | mes "Jemand hat dich als geworben angegeben!"; | |
| 108 | mes "^FF0000---- Name/Nachricht ----^000000"; | |
| 109 | mes .@aid[ 0 ]; | |
| 110 | mes .@message$[ 0 ]; | |
| 111 | next; | |
| 112 | mes "Möchtest du diese Anfrage bestätigen oder ablehnen?"; | |
| 113 | ||
| 114 | if( Select( "Bestätigen.", "Ablehnen." ) == 2 ){
| |
| 115 | mes "^ff0000Du hast abgelehnt.^000000"; | |
| 116 | Query_SQL( "UPDATE `geworben` SET `confirmed` = '1' WHERE `account_id` = " + .@aid ); | |
| 117 | close; | |
| 118 | }else{
| |
| 119 | mes "Du hast bestätigt!"; | |
| 120 | Query_SQL( "UPDATE `geworben` SET `confirmed` = '2' WHERE `account_id` = " + .@aid ); | |
| 121 | mes "^008800Erfolgreich eingetragen!^000000"; | |
| 122 | close; | |
| 123 | } | |
| 124 | }/* | |
| 125 | DROP TABLE IF EXISTS `geworben`; | |
| 126 | CREATE TABLE `geworben` ( | |
| 127 | `account_id` int(11) NOT NULL, | |
| 128 | `friend_id` int(11) NOT NULL, | |
| 129 | `message` text NOT NULL, | |
| 130 | `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
| 131 | `confirmed` int(11) NOT NULL, | |
| 132 | PRIMARY KEY (`account_id`) | |
| 133 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | |
| 134 | */ | |
| 135 | ||
| 136 | prontera,155,175,6 script Test 606,{
| |
| 137 | ||
| 138 | query_sql("select `account_id` from `login` WHERE `account_id` = " + GetCharID( 3 ), .@WerberID);
| |
| 139 | ||
| 140 | set .@npcname$, "[^FF0000Admin Panel^000000]"; | |
| 141 | mes .@npcname$; | |
| 142 | mes "Was möchtest du tun?"; | |
| 143 | if( Select( "Freund ^008800eintragen^000000", "Freund ^FF0000entfernen^000000", "Alle Freunde einsehen", "Beenden" ) == 4 ) | |
| 144 | close; | |
| 145 | ||
| 146 | // alle Auflisten | |
| 147 | if( @menu == 3 ) {
| |
| 148 | next; | |
| 149 | set .@c, Query_SQL( "SELECT `account_id`, `message`, DATE_FORMAT(`time`, '%d.%m.%Y'), `confirmed` FROM `geworben`", .@aid, .@message$, .@date$ ); | |
| 150 | if( .@c == 0 ) {
| |
| 151 | mes .@npcname$; | |
| 152 | mes "^FF0000Derzeit sind keine Freunde im System eingetragen^000000"; | |
| 153 | close; | |
| 154 | } | |
| 155 | mes "[^FF0000geworben Liste - " + .@c + " Accounts^000000]"; | |
| 156 | mes "[Nr] <AID> (<letzter Login>)"; | |
| 157 | for( set .@i, 0; .@i < .@c; set .@i, .@i + 1 ) | |
| 158 | mes "[" + ( .@i + 1 ) + "] " + .@aid[ .@i ] + " (" + .@date$[ .@i ] + ")";
| |
| 159 | close; | |
| 160 | } | |
| 161 | ||
| 162 | // Spieler suchen | |
| 163 | mes "Spieler Name?"; | |
| 164 | do {
| |
| 165 | Input( .@name$ ); | |
| 166 | set .@c, Query_Sql( "SELECT `account_id` FROM `char` WHERE `name` = '" + .@name$ + "'", .@FriendID ); | |
| 167 | ||
| 168 | if( .@jCount == 1 ){ // Bereits in Table
| |
| 169 | next; | |
| 170 | mes "^ff0000Für diese Aktion besteht bereits eine Anfrage!^000000"; | |
| 171 | close; | |
| 172 | } | |
| 173 | if( .@c == 0 ) {
| |
| 174 | mes "^ff0000'" + .@name$ + "' wurde nicht gefunden!^000000"; | |
| 175 | if( Select( "nochmal eingeben", "Beenden" ) == 2 ) | |
| 176 | close; | |
| 177 | } | |
| 178 | } while( .@c < 1 ); | |
| 179 | ||
| 180 | ||
| 181 | ||
| 182 | set .@jCount, Query_SQL( "SELECT `account_id`, `friend_id` , `message`, DATE_FORMAT(`time`, '%d.%m.%Y' ) FROM `geworben` WHERE `account_id` = " + .@WerberID, .@FriendID, .@message$, .@date$ ); | |
| 183 | ||
| 184 | ||
| 185 | mes " "+.@WerberID+", "+.@FriendID+" "; | |
| 186 | ||
| 187 | ||
| 188 | mes "^0000FFSpieler^000000: " + .@name$ + " "; | |
| 189 | if( .@jCount > 0 ) {
| |
| 190 | mes "^0000FFNachricht^000000: " + .@message$; | |
| 191 | mes "^0000FFLogin^000000: " + .@date$; | |
| 192 | } | |
| 193 | ||
| 194 | ||
| 195 | ||
| 196 | // Spieler hinzufügen | |
| 197 | if( @menu == 1 ) {
| |
| 198 | if( Select( "Okay, eintragen!", "Abbrechen!" ) == 2 ){
| |
| 199 | mes "^ff0000Abbruch...^000000"; | |
| 200 | close; | |
| 201 | } | |
| 202 | if( .@jCount == 1 ){ // Bereits in Table
| |
| 203 | mes "^ff0000Für diese Aktion besteht bereits eine Anfrage!^000000"; | |
| 204 | close;} | |
| 205 | else{
| |
| 206 | mes "Bitte eine Nachricht eingeben!"; | |
| 207 | Input( .@message$ ); | |
| 208 | Query_SQL( "INSERT INTO `geworben` VALUES ( " + .@WerberID + ", " + .@FriendID + ", '" + .@message$ + "', '0000-00-00 00:00:00', '0' );" ); | |
| 209 | close; | |
| 210 | } | |
| 211 | } | |
| 212 | ||
| 213 | // enfernen | |
| 214 | if( .@jCount == 0 ) {
| |
| 215 | mes "^FF0000Der Account steht nicht im geworben!^000000"; | |
| 216 | close; | |
| 217 | } | |
| 218 | ||
| 219 | if( Select( "Okay, entfernen!", "Abbrechen!" ) == 2 ){
| |
| 220 | mes "^ff0000Abbruch...^000000"; | |
| 221 | close; | |
| 222 | } | |
| 223 | ||
| 224 | Query_SQL( "DELETE FROM `geworben` WHERE account_id = " + .@AccountID ); | |
| 225 | mes "^008800Erfolgreich entfernt!^000000"; | |
| 226 | close; | |
| 227 | ||
| 228 | OnPCLoginEvent: | |
| 229 | if( Query_SQL( "SELECT `message`, `account_id` FROM `geworben` WHERE `friend_id` = " + GetCharID( 3 ), .@message$, .@aid ) == 0 ) | |
| 230 | end; | |
| 231 | Query_SQL( "UPDATE `geworben` SET `time` = NOW() WHERE `friend_id` = " + GetCharID( 3 ) ); | |
| 232 | ||
| 233 | mes "[^FF0000 ExRO geworben ^000000]"; | |
| 234 | mes "Jemand hat dich als geworben angegeben!"; | |
| 235 | mes "^FF0000---- Name/Nachricht ----^000000"; | |
| 236 | mes .@message$[ 0 ]; | |
| 237 | next; | |
| 238 | mes "Möchtest du diese Anfrage bestätigen oder ablehnen?"; | |
| 239 | ||
| 240 | if( Select( "Einverstanden", "Nein, danke." ) == 2 ) | |
| 241 | mes "^ff0000Du hast abgelehnt.^000000"; | |
| 242 | Query_SQL( "UPDATE `geworben` SET `confirmed` = '2' WHERE `account_id` = " + .@aid ); | |
| 243 | close; | |
| 244 | mes "Du hast bestätigt!"; | |
| 245 | Query_SQL( "UPDATE `geworben` SET `confirmed` = '1' WHERE `account_id` = " + .@aid ); | |
| 246 | mes "^008800Erfolgreich eingetragen!^000000"; | |
| 247 | close; | |
| 248 | } |