[Tutorial] [TUT]Lotto script
#21

nice tut thanks again
Reply
#22

niceeeee
Reply
#23

C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(4 : error 017: undefined symbol "GetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(49) : error 017: undefined symbol "SetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(6 : error 017: undefined symbol "GetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(69) : error 017: undefined symbol "SetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(86) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Help me please
Reply
#24

If I was new to scripting I wouldn't have understand something of this, conclusion: To complicated
Reply
#25

Quote:
Originally Posted by Elviss
View Post
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(4 : error 017: undefined symbol "GetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(49) : error 017: undefined symbol "SetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(6 : error 017: undefined symbol "GetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(69) : error 017: undefined symbol "SetPVarInt"
C:\Users\Elvis\Desktop\Server\GTARP\filterscripts\ Loto.pwn(86) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Help me please
Use the 0.3 Includes.

Quote:
Originally Posted by Claude
View Post
If I was new to scripting I wouldn't have understand something of this, conclusion: To complicated
It's pretty hard to make this less complicated.
Reply
#26

Nice one, Claude what wouldn't you understand of it. Its all well explained in the comments. Good work!!
Reply
#27

C:\Users\Elvis\Desktop\Server 3b\gamemodes\loto.pwn(91) : warning 203: symbol is never used: "dcmd_lotto"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.
HELP
Reply
#28

You forgot to add the lotto command.
Reply
#29

Quote:
Originally Posted by Amit_B
View Post
Where's the tutorial?
You've just posted your own lotto system and teached where to put every code in the script.
I have to agree, although it's more of a walkthrough than a tutorial...
Reply
#30

Quote:
Originally Posted by Lenny the Cup
View Post
I have to agree, although it's more of a walkthrough than a tutorial...
I'm trying to give people a insight on what to do. I'm not going to write out what every single function means or does. Most of my tutorials are so people can make their own better ones .
Reply
#31

Good Tutorial
Reply
#32

aw crap its dcmd!
Reply
#33

Then convert it to ZCMD... It's not that hard.
Reply
#34

wrong browser sorry!
Reply
#35

not work i don't know why cmds work but no announce ment and lotto winner

pawn Код:
#include <a_samp> //You need the a_samp include in almost every script.
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 //DCMD
#define LOTTO_JACKPOT 10000   //How much it goes up every 30 seconds or whenever someone buys a ticket
#define LOTTO_START      200000 //How much the lotto starts off at every draw
#define LOTTO_DRAW      10         //How many minutes between each lotto draw
#define TICKET_COST      1000     //How much a ticket will cost
new Jackpot = LOTTO_START;                                 //Jackpot amount
new Numbers[100];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    SetTimer("UpdateJP", 30000, true); //Updates the jackpot
    SetTimer("Draw", LOTTO_DRAW*1000*60, true); //Updates the jackpot
    return 1;
}

forward UpdateJP(); //Always forward a timer

public UpdateJP()
{
    Jackpot = Jackpot + LOTTO_JACKPOT; //Ads to the lotto jackpot
    return 1;
}
forward Draw();
public Draw()
{
    new Lnum = random(100) + 1; //Picks a random number
    new winner = -1; //Winners ID variable
    for(new i; i<MAX_PLAYERS; i++) //checks through all players
    {
        if(!IsPlayerConnected(i)) continue; //Players not connected
        if(GetPVarInt(i, "LottoNumber") == Lnum) winner = i; //If the players number is the winning number
        SetPVarInt(i, "LottoNumber", 0); //Resets the number
    }
    if(winner != -1) //If there was a winner
    {
        new Pname[24];
        GetPlayerName(winner, Pname, 24);
        new str[100];
        SendClientMessageToAll(0x62FF32FF, "****LOTTO INFORMATION****"); //Lotto info
        format(str, sizeof(str), "WE HAVE A WINNER! %s(%d) won $%d!!!!", Pname, winner, Jackpot);
        SendClientMessageToAll(0x62FF32FF, str); //Lotto info
        SendClientMessageToAll(0x62FF32FF, "Make sure you get a ticket for next draw /lotto [1-100]!!"); //Lotto info
        GivePlayerMoney(winner, Jackpot); //Gives the winner the cash
        Jackpot = LOTTO_START; //Resets the jackpot
    }
    if(winner == -1) //No winner
    {
                new str[100];
        SendClientMessageToAll(0x62FF32FF, "****LOTTO INFORMATION****"); //Lotto info
        format(str, sizeof(str), "There was no lotto winner for this draw. The jackpot will go up to $%d!", Jackpot);
        SendClientMessageToAll(0x62FF32FF, str); //Lotto info
        SendClientMessageToAll(0x62FF32FF, "Make sure you get a ticket for next draw /lotto [1-100]!!");
    }
    for(new s; s<100; s++)
    {
        Numbers[s] = 0; //Resets all numbers so they are usable.
    }
    return 1;
}
public OnFilterScriptExit()
{
    return 1;
}

#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(lotto, 5, cmdtext);
    return 0;
}

dcmd_lotto(playerid, params[])
{
    if(!strlen(params)) //If the player doesn't put a nubmer
    {
        SendClientMessage(playerid, 0x62FF32FF, "***Lotto information***"); //Lotto info
        SendClientMessage(playerid, 0x62FF32FF, "Pick a number between 1 and 100 with /lotto [1-100]"); //Lotto info
        new str[75]; //Creates the string
        format(str, sizeof(str), "Current Jackpot is $%d!!!!", Jackpot); //Formats the jackpot string
        SendClientMessage(playerid, 0x62FF32FF, str); //Shows the current jackpot
    }
    new Num = strval(params); //Makes the param that the player entered into a intiger
    if(Numbers[Num] == 1) //If the number is used
    {
        new str[75]; //Makes a variable
        format(str, sizeof(str), "Lotto number %d is already taken!", Num); //Formats a str
        SendClientMessage(playerid, 0xE21F1FFF, str); //Sends the message
        return 1;
    }
    if(GetPVarInt(playerid, "LottoNumber") != 0) return SendClientMessage(playerid, 0xE21F1FFF, "You have already got a lotto number");
    SetPVarInt(playerid, "LottoNumber", Num); //Sets the players number
    Numbers[Num] = 1; //Number is used
    GivePlayerMoney(playerid, -TICKET_COST); //Takes away the ticket cost.
    new str[75];
    format(str, sizeof(str), " Lotto ticket brought! You now have number %d for the next draw", Num);
    SendClientMessage(playerid, 0x62FF32FF, str); //Lotto info
    format(str, sizeof(str), " Draws are held every %d minutes and the winners are announced. Current jackpot is $%d", LOTTO_DRAW, Jackpot);
    Jackpot = Jackpot + LOTTO_JACKPOT; //Ads to the lotto jackpot
    SendClientMessage(playerid, 0x62FF32FF, str); //Lotto info
    return 1;
}
Reply
#36

Nice
Reply
#37

Nice 10/10 but i getting a headache

when i try the command i can even buy the number 0 ticket how can fix this [HiC]TheKiller?
Reply
#38

Nice tutorial, and thanks btw
Reply
#39

in the dcmd_lotto, after this line:
pawn Код:
new Num = strval(params);
...add a check if the Num variable is lower than 1, or higher than 100:
pawn Код:
if(Num<1 || Num>100) //if Num<1 or >100 then cancel
    {
        SendClientMessage(playerid, 0xE21F1FFF, "ou should pick a number from 1 to 100");
        return 1;
    }
before the other loop (checking for that number already been chosen)
Reply
#40

Having problem, when i add it as FilterScript in my gm, than when i go in game, tp /lotto 1 than it shows you have buyd ticket and so on.. all works but it isnt taking money from player, it takes money but the money go back as it was befaur. How can i put it that it takes the money? I tried to put that all to my gm but than the comand didnt work, it says: Unknown command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)