AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Entity plugin (https://forums.alliedmods.net/showthread.php?t=255250)

DannyQueen 01-12-2015 10:55

Entity plugin
 
Hello Dear Friends!
-------------
Сan someone please help me with plugin [Problems: Error and Warning]
-------------
About plugin:
If the player with the admin status next to an ordinary player and has a distance of 2-3 unit then the admin player can steal all the money simple player. -> if the admin player write nickname

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>

new iPlayers[32] ,playerCount, player ;

public plugin_init()
{
        register_plugin("RobPlayer", "1.00", "DannyQueen")
        register_clcmd("say", "rob_say")
}

public rob_say(id)
{
       
        new szMsg[34];
        read_args(szMsg, charsmax(szMsg));
       
        if (strlen(szMsg) > 32)
        return PLUGIN_CONTINUE
               
        new iPlayers[32], szName[33] ,playerCount, player
        get_user_name(player,szName,charsmax(szName));
        get_players(iPlayers, playerCount, "ach");
       
        for (new i = 0; i < playerCount; i++)
        {
                player = iPlayers[i] ;
               
                if (player == id) continue;
               
                if( entity_range(id, player) < 3.0)
                {
                        if (equal(szMsg,szName))
                        {                               
                                cs_set_user_money(id, cs_get_user_money(id) + cs_get_user_money(player))
                        }
                }
        }       
}


Please! Help ME!
In our country havent forum of scripting :C

[ I'm newbie scripter C: And a foreigner... And perhaps in this text contains errors... (P.S. My english is BAD)]

THANKS FOR HELP!

Fuck For Fun 01-12-2015 11:08

Re: Entity plugin
 
there no error just, 4 warning.

You miss one line before last added
Quote:

return PLUGIN_HANDLED;
Line 6:
Code:

new iPlayers[32], playerCount, player;
They do not Uses

There is no need it:
Code:

#include <amxmisc>
Check now the Code:
PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>

public plugin_init() 
{
    
register_plugin("RobPlayer""1.00""DannyQueen")
    
register_clcmd("say""rob_say")
}

public 
rob_say(id)
{
    
    new 
szMsg[34];
    
read_args(szMsgcharsmax(szMsg));
    
    if (
strlen(szMsg) > 32)
    return 
PLUGIN_CONTINUE
        
    
new iPlayers[32], szName[33] ,playerCountplayer 
    get_user_name
(player,szName,charsmax(szName));
    
get_players(iPlayersplayerCount"ach");
    
    for (new 
0playerCounti++)
    {
        
player iPlayers[i] ;
        
        if (
player == id) continue;
        
        if( 
entity_range(idplayer) < 3.0)
        {
            if (
equal(szMsg,szName))
            {                
                
cs_set_user_money(idcs_get_user_money(id) + cs_get_user_money(player))
            }
        }
    }
    
    return 
PLUGIN_HANDLED;



DannyQueen 01-12-2015 12:28

Re: Entity plugin
 
Can i ask you?
Emm... The plugin will work? C:

Fuck For Fun 01-12-2015 17:02

Re: Entity plugin
 
First of all check it

Natsheh 01-12-2015 17:36

Re: Entity plugin
 
Is this dating website? You seems a cute girl <3

& Btw @fuck for fun no need for looping throw all players use cmd_target

DannyQueen 01-13-2015 09:04

Re: Entity plugin
 
Fuck For Fun, Thanks... The plugin is compiled
But does not work

Natsheh 01-13-2015 09:59

Re: Entity plugin
 
Here's Babe if you want a working Code :*

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <engine>

public plugin_init() 
{
    
register_plugin("Rob Player""1.0""Natsheh & DannyQueen")
    
register_clcmd("say""rob_say")
}

public 
rob_say(id)
{
    new 
sArgs[34];
    
read_args(sArgscharsmax(sArgs));
    
    if(
strlen(sArgs) > 32)
        return
    
    new 
player find_player("ab"sArgs)
    
    if(!
player || get_entity_distance(idplayer) > 3.0 || id == player)
    {
        
client_print(idprint_chat"[ Robbing Failed ] Can not find a player near you with that name!")
        return
    }
    else if(!
cs_get_user_money(player))
    {
        
client_print(idprint_chat"[ Robbing Failed ] There is no money to rob from this player!")
        return
    }
    
    
cs_set_user_money(idcs_get_user_money(id) + cs_get_user_money(player))
    
cs_set_user_money(player0)



Sorry i fixed up the code, now the player can not rob himself

Jhob94 01-13-2015 10:22

Re: Entity plugin
 
Natesh, go out, find a real girl and have fun. Anyway, how you know it's a girl? You have any idea that it can be a guy and you are talking like that to a guy? :bee:

DannyQueen 01-13-2015 11:49

Re: Entity plugin
 
Natsheh, im not girl
Nickname: DannyQueen
Danny - it's boys name and "Queen" is surname

DannyQueen 01-13-2015 11:49

Re: Entity plugin
 
Need to change nickname:D


All times are GMT -4. The time now is 15:32.

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