Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_ERRO 0x800000FF
- #define COLOR_VERDE 0x80FF00FF
- forward SendMSG();
- new bool:spinusar[MAX_PLAYERS];
- forward SpinUsar1(playerid);
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("> Sistema de SPIN: Ligado");
- print("> Criado por Neto com ajuda de Cidiei");
- print("--------------------------------------\n");
- SetTimer("SendMSG", 300000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(SendMSG);
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid,COLOR_VERDE, "Sistema de SPIN criado por Neto com ajuda de Cidiei!");
- spinusar[playerid] = true;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/spin", true) == 0)
- {
- new string[256];
- new tmp[256];
- new guito,playerguito;
- new pname[24];
- GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp))
- {
- SendClientMessage(playerid, COLOR_ERRO, "[ERRO:]{ffffff} Use /spin [dinheiro]");
- return 1;
- }
- guito = strval(tmp);
- if(guito < 1 || guito > 50000)
- {
- SendClientMessage(playerid, COLOR_ERRO, "[SPIN:]{ffffff} Quantia invΓ‘lida, tem que ser mais de 0 e menos de 50000");
- return 1;
- }
- if(spinusar[playerid] == true)
- {
- playerguito = GetPlayerMoney(playerid);
- if (guito > 0 && playerguito >= guito)
- {
- new succeed = 1 + random(4);
- if(succeed == 1)
- {
- format(string, sizeof(string), "[SPIN:]{ffffff} %s tentou jogar no spin e ganhou {66ff00}%d", pname, guito);
- SendClientMessageToAll(COLOR_VERDE, string);
- GivePlayerMoney(playerid, guito);
- spinusar[playerid] = false;
- SetTimerEx("SpinUsar1", 30000, false, "d", playerid);
- }
- else if(succeed == 2 || succeed == 3 || succeed == 4)
- {
- format(string, sizeof(string), "[SPIN:]{ffffff} %s tentou jogar no spin e perdeu {A81C1C}%d", pname, guito);
- SendClientMessageToAll(COLOR_VERDE, string);
- GivePlayerMoney(playerid, -guito);
- spinusar[playerid] = false;
- SetTimerEx("SpinUsar1", 30000, false, "d", playerid);
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERRO, "[SPIN:]{ffffff} NΓ£o tens esse dinheiro todo");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_ERRO, "[SPIN:]{ffffff} Espera 30 segundos para voltar a usar o comando");
- }
- return 1;
- }
- return 0;
- }
- stock 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 SpinUsar1(playerid)
- {
- spinusar[playerid] = true;
- return 1;
- }
- public SendMSG()
- {
- new string[500];
- format(string, sizeof(string), "Sistema de SPIN criado por Neto com ajuda de Cidiei!");
- SendClientMessageToAll(COLOR_VERDE, string);
- }
Advertisement
Add Comment
Please, Sign In to add comment