FloRaX
BANNED
|
|
| Registrierung: |
22.08.2007, 21:05 |
| User-Info: |
It´s over 9000!!!!!!!!!!! |
| Homepage: |
http://www.sxp-network.com |
| Lieblings-GTA: |
GTA: Vice City Stories |
| Wohnort: |
American Dream |
| Xbox Live Gamertag: |
Meicel |
| GFWL-Tag: |
Meicel |
| Social Club: |
N0RAX1994 |
| Beiträge: |
3700
|
|
Code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| #include <a_samp>
#define COLOR_WHITE 0xFFFFFFAA #define COLOR_YELLOW 0xFFFF00AA
new bank[MAX_PLAYERS];
strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; }
new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; }
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new idx; new bank[MAX_PLAYERS];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/speichern", true) == 0 ) { new tmp[256]; new moneys; new string[256]; tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Benutzung: /speichern [Geldbetrag]"); return 1; } moneys = strval(tmp); if(GetPlayerMoney(playerid) < moneys) { moneys = GetPlayerMoney(playerid); } GivePlayerMoney(playerid, 0-moneys); bank[playerid]+=moneys; format(string, sizeof(string), "Du hast %d$ gespeichert, dein Kontostand lautet: %d$", moneys, bank[playerid]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; }
if(strcmp(cmd, "/abheben", true) == 0) { new string[256]; new moneys; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Benutzung: /abheben [Geldbetrag]"); return 1; } moneys = strval(tmp); if(moneys > bank[playerid]) moneys = bank[playerid];
GivePlayerMoney(playerid, moneys); bank[playerid] -= moneys; format(string, sizeof(string), "Du hast %d$ abgehoben, dein Kontostand lautet: %d$", moneys, bank[playerid]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; }
if(strcmp(cmd, "/konto", true) == 0) { new string[256]; format(string, sizeof(string), "Dein Kontostand lautet: %d$", bank[playerid]); SendClientMessage(playerid, COLOR_YELLOW, string); return 1; } return 0; }
stock PlayerName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); return name; }
public OnPlayerConnect(playerid) { if (!udb_Exists(PlayerName(playerid))) { new fname[MAX_STRING];
format(fname,sizeof(fname),"%s.sav",udb_encode(PlayerName(playerid))); dini_Create(fname); } if (udb_Exists(PlayerName(playerid))) { bank[playerid]=dUserINT(PlayerName(playerid)).("bank"); } return 1; }
public SavedUpdate() { for (new i; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { dUserSetINT(PlayerName(i)).("bank",bank[i]); } } }
|
Dieser Beitrag wurde insgesamt 1 mal editiert. Das letzte Mal 29.07.2008, 18:57 von FloRaX.
|
|