Raised This Month: $ Target: $400
 0% 

giveplayeritem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 07-26-2011 , 20:58   giveplayeritem
Reply With Quote #1

I'm making a plugin that when using a console command on the player gets a weapon, but is going wrong in that part wrong?

PHP Code:
new const String:PLUGIN_VERSION[60] = "0.0.0.1";
new 
weapon_scout

public Plugin:myinfo = {
    
    
name "scoutplease",
    
author "Rodrigo286",
    
description "Da uma scout caso o jogador use o comando no console.",
    
version PLUGIN_VERSION,
    
url "http://www.sourcemod.net/"
    
};

#include <sourcemod>
#include <sdktools>
#include <cstrike>"
#pragma semicolon 1

public OnPluginStart(){

    
CreateConVar("scoutplease"PLUGIN_VERSION"plugin info cvar"FCVAR_REPLICATED);
    
HookEvent("round_start"MyCallBackName_roundstart);
    
    
RegConsoleCmd("scoutplz"scout"scout please");
    
}

public 
Action:scout(clientArgs){
    
    
decl Float:clientpos[3];
    
GivePlayerItem(clientweapon_scout)
    return 
Plugin_Continue;
    

rodrigo286 is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 07-27-2011 , 02:49   Re: giveplayeritem
Reply With Quote #2

PHP Code:
GivePlayerItem(clientweapon_scout
to

PHP Code:
GivePlayerItem(client"weapon_scout"
you forgot the quotes


and
PHP Code:
return Plugin_Continue
to

PHP Code:
return Plugin_Handled
Despirator is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 07-27-2011 , 13:19   Re: giveplayeritem
Reply With Quote #3

It worked perfectly, had not seen this simple mistake.

I'm trying to do something else, like that after 30 seconds the plugin does not work is that more and so do not scout for those who use the scout command.


PHP Code:
new Handle:g_hTimer

public 
Action:scout(clientArgs){
    
    if (
g_hTimer == INVALID_HANDLE)
    {
    
// continue
    
}
    
    new 
equipped GetEntPropEnt(clientProp_Send"m_hActiveWeapon");
    
GivePlayerItem(client"weapon_scout");
    
EquipPlayerWeapon(clientequipped); 
    return 
Plugin_Handled;
    
}

public 
EventRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
// kill previous timer if it still goin...
    
if (g_hTimer != INVALID_HANDLE)
    {
        
KillTimer(g_hTimer);
        
g_hTimer INVALID_HANDLE;
    }

    
// if still enabled, create new timer
    
g_hTimer CreateTimer(30.0TimerCallback);
}

public 
Action:TimerCallback(Handle:timer)
{
    
g_hTimer INVALID_HANDLE;

The compilation was successful but after 30 seconds the command "scout" continues to give weapon, could also help me with this?

Thanks.
rodrigo286 is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 07-27-2011 , 15:25   Re: giveplayeritem
Reply With Quote #4

PHP Code:
// continue 
to
PHP Code:
return Plugin_Handled
Despirator is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 07-27-2011 , 15:53   Re: giveplayeritem
Reply With Quote #5

But now I can not get the scout with the command, wish that would happen after 30 seconds of the round.

Super thanks.

#EDIT
I have found the error, thank you, now is perfect!

Last edited by rodrigo286; 07-27-2011 at 16:26.
rodrigo286 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 17:59.


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