Raised This Month: $ Target: $400
 0% 

Entity plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DannyQueen
Junior Member
Join Date: Jan 2015
Old 01-12-2015 , 10:55   Entity plugin
Reply With Quote #1

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!
DannyQueen is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-12-2015 , 11:08   Re: Entity plugin
Reply With Quote #2

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;

Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
DannyQueen
Junior Member
Join Date: Jan 2015
Old 01-12-2015 , 12:28   Re: Entity plugin
Reply With Quote #3

Can i ask you?
Emm... The plugin will work? C:
DannyQueen is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 01-12-2015 , 17:02   Re: Entity plugin
Reply With Quote #4

First of all check it

Last edited by Fuck For Fun; 01-12-2015 at 17:03.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-12-2015 , 17:36   Re: Entity plugin
Reply With Quote #5

Is this dating website? You seems a cute girl <3

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

Last edited by Natsheh; 01-12-2015 at 17:41.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DannyQueen
Junior Member
Join Date: Jan 2015
Old 01-13-2015 , 09:04   Re: Entity plugin
Reply With Quote #6

Fuck For Fun, Thanks... The plugin is compiled
But does not work
DannyQueen is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 01-13-2015 , 09:59   Re: Entity plugin
Reply With Quote #7

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

Last edited by Natsheh; 01-13-2015 at 16:31.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 01-13-2015 , 10:22   Re: Entity plugin
Reply With Quote #8

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?
__________________
Jhob94 is offline
DannyQueen
Junior Member
Join Date: Jan 2015
Old 01-13-2015 , 11:49   Re: Entity plugin
Reply With Quote #9

Natsheh, im not girl
Nickname: DannyQueen
Danny - it's boys name and "Queen" is surname
DannyQueen is offline
DannyQueen
Junior Member
Join Date: Jan 2015
Old 01-13-2015 , 11:49   Re: Entity plugin
Reply With Quote #10

Need to change nickname
DannyQueen is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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