AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] - Every Round (https://forums.alliedmods.net/showthread.php?t=335022)

Yusochan 11-03-2021 19:16

[HELP] - Every Round
 
Hello !

I wanna the part of script that set something every round

Like a
PHP Code:

 set_task 

I have a plugin that gives a bonus and idk how to set it each new round. and if u want the script here is it :
Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <cromchat>

//PS : I know my code is shitty so please don't remind me about it :)

new g_pPrefix;

public plugin_init() {
        register_plugin("Steam Bonus", "2.0", "YusoChan-");
       
        RegisterHam(Ham_Spawn, "player", "PlayerPostSpawn", 1);
       
        CC_SetPrefix("&x01[&x04FURIEN.NPOWERED.RO&x01]");
}

public client_putinserver(id)
{
        set_task(1.0, "GIVE", id)
}

public GIVE(id)
{
        if(is_user_alive(id) || !is_user_steam(id)) {
                return PLUGIN_HANDLED;
        }       
        new name[33]
        get_user_name( id, name, 32 )
        set_user_health(id, get_user_health(id) + 25);
        cs_set_user_money(id, cs_get_user_money(id) + 2500);
        set_user_armor(id, get_user_armor(id) + 25);
        //Message:
        CC_SendMessage(id, "%s &x01Dear: &x04%s &x03You have got &x042500&x01$/&x0425&x01HP/&x0425&x01AP/", g_pPrefix, name);
        return 0;
}

stock bool:is_user_steam(id)
{
        static dp_pointer
        if(dp_pointer || (dp_pointer = get_cvar_pointer("dp_r_id_provider")))
        {
                server_cmd("dp_clientinfo %d", id)
                server_exec()
                return (get_pcvar_num(dp_pointer) == 2) ? true : false
        }
        return false
}


Napoleon_be 11-03-2021 19:37

Re: [HELP] - Every Round
 
Here's on how to catch every new round/round start/round end/player spawn: https://forums.alliedmods.net/showthread.php?t=42159

Just use new round or round start instead of player spawn. Allthough player spawn works as good.

PS: Use charsmax() instead of hardcoding array sizes.

PHP Code:

new szName[32];
get_user_name(idszNamecharsmax(szName)); // Same as : get_user_name(id, szName, 31); 


Yusochan 11-04-2021 07:42

Re: [HELP] - Every Round
 
Quote:

Originally Posted by Napoleon_be (Post 2762403)
Here's on how to catch every new round/round start/round end/player spawn: https://forums.alliedmods.net/showthread.php?t=42159

Just use new round or round start instead of player spawn. Allthough player spawn works as good.

PS: Use charsmax() instead of hardcoding array sizes.

PHP Code:

new szName[32];
get_user_name(idszNamecharsmax(szName)); // Same as : get_user_name(id, szName, 31); 


Thanks sir ! u are always here to help me :)


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

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