AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] Not Enough Points for Play (https://forums.alliedmods.net/showthread.php?t=282484)

Tatu Eugen 05-08-2016 05:25

[Help] Not Enough Points for Play
 
Hello i have a small lottery system and this plugin gets points from player when he enter to play, the problem is get -500 and save -500 in file if player don't have 500 points, i don't want to give -500 in save file, i want if player don't have enough 500 can't join to play... any help? Thanks guys :)
Code:

public lotto (id) {
        if(zagral[id]) {
                client_print(0,print_chat,"[CSR] Play at every 5 minutes.");
                return PLUGIN_HANDLED;
        }
        Points[id]-=500;
        client_print(id,print_chat,"[CSR] You join, -500 points.");
        set_task(60.0,"kumulacja",id);
        Save(id);
        return PLUGIN_CONTINUE;
}


EpicKiller 05-08-2016 07:14

Re: [Help] Not Enough Points for Play
 
You could add a check to see if the player has enough credits.

PHP Code:

public lotto(id)
{
    if(
Points[id] < 500)
    {
        
client_print(idprint_chat"You don't have enough credits!");
        
        return 
PLUGIN_HANDLED;
    }
    
    
//...
    //...



Tatu Eugen 05-08-2016 08:13

Re: [Help] Not Enough Points for Play
 
Quote:

Originally Posted by EpicKiller (Post 2417598)
You could add a check to see if the player has enough credits.

PHP Code:

public lotto(id)
{
    if(
Points[id] < 500)
    {
        
client_print(idprint_chat"You don't have enough credits!");
        
        return 
PLUGIN_HANDLED;
    }
    
    
//...
    //...



Works, thanks man :D


All times are GMT -4. The time now is 18:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.