Jump to content
  • 0

Nu se executa comanda atunci cand o dau


Question

Salut, de data asta, am o problema mai ciudata, care nu am mai intalnit o pana acum.

Adica cand dau comanda prima data nu merge, dar daca o spamez de multe ori pana la urma merge.

Aceasta este comanda:
 

 CMD:trylucky(playerid, params[])
{
    new amount, string[64], rand = random(50);
    if(!PlayerToPoint(2.0, playerid, 386.7224,-1817.7662,7.8409))
    {
        SetPlayerCheckpointEx(playerid, 386.7224,-1817.7662,7.8409, 5.0);
        CP[playerid] = 678; 
        SCM(playerid, COLOR_GREY, "You are not at the right place.");
        SCM(playerid, COLOR_YELLOW, "Ti-am pus un checkpoint catre locatie, du-te la el!");
        return 1;
    }
    if(sscanf(params, "i", amount)) return SCM(playerid, -1, "{CECECE}USAGE: {FFFFFF}/trylucky <amount>");
    if(amount < 10000) return SCM(playerid, COLOR_GREY, "Suma trebuie sa fie de minim $10.000.");
    if(GetPlayerCash(playerid) < amount) return SCM(playerid, -1, "Nu ai aceasta suma de bani.");

    switch(rand) {
        case 0: 
        {
            format(string, sizeof(string), "You lost $%s.", FormatNumber(amount));
            SCM(playerid, COLOR_GREEN, string);
            GivePlayerCash(playerid, -amount);
            Update(playerid, pCashx);
        }
        case 1:
        {
            format(string, sizeof(string), "Congratulations, %s! You won $%s.", GetName(playerid), FormatNumber(amount+amount));
            SCM(playerid, COLOR_GREEN, string);
            GivePlayerCash(playerid, amount+amount);
            Update(playerid, pCashx);
        }
    }
    return 1;

Edited by Raduq
Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Ce parte nu se executa? Ce cu lose/win?

Iti spun exact de ce anume. Rand are valori intre 0-50 tu in switch verifici doar daca rand are valoare 0 sau 1. Probabilitatea ca rand sa ia acezte valori din cele 50 numere este mica de aceea spui ca nu ti se executa comanda mereu

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.