Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #if defined FILTERSCRIPT
- #define COLOR_PINK 0xFF66FFAA
- #define COLOR_GREEN 0x18FF18FF
- #define COLOR_BLUE 0x0000FFFF
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- new Horse[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Horse Bets by WillsuckformoneY");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerDisconnect(playerid, reason)
- {
- Horse[playerid]=0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(hbet, 4, cmdtext);
- return 0;
- }
- dcmd_hbet(playerid, params[]) {
- new Index, tmp[256]; tmp=strtok(params, Index);
- if(!strlen(tmp)||strval(tmp)<1||strval(tmp)>3) return SendClientMessage(playerid,COLOR_PINK,"FAIL! Do /Bet [1 - 3]");
- switch(strval(tmp))
- {
- case 1:
- {
- SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 1");
- GivePlayerMoney(playerid, -100);
- SetTimerEx("BETS", 60000, 0, "d", playerid);
- Horse[playerid]=1;
- }
- case 2:
- {
- SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 2");
- GivePlayerMoney(playerid, -200);
- SetTimerEx("BETS", 60000, 0, "d", playerid);
- Horse[playerid]=2;
- }
- case 3:
- {
- SendClientMessage(playerid, COLOR_BLUE, "You Selected Horse 3");
- GivePlayerMoney(playerid, -300);
- SetTimerEx("BETS", 60000, 0, "d", playerid);
- Horse[playerid]=3;
- }
- }
- return 1;
- }
- forward BETS(playerid);
- public BETS(playerid)
- {
- new Num;
- Num=random(3)+1;
- if(Num==Horse[playerid])
- {
- switch(Horse[playerid])
- {
- case 1: { GivePlayerMoney(playerid, 200); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $200 From your Horse Bet"); }
- case 2: { GivePlayerMoney(playerid, 400); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $400 From your Horse Bet"); }
- case 3: { GivePlayerMoney(playerid, 600); SendClientMessage(playerid, COLOR_PINK, "Congratulations, You won $600 From your Horse Bet"); }
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREEN, "Sorry! You did NOT win From your Horse Bet, Better luck next time!!");
- }
- return 1;
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement