Raised This Month: $ Target: $400
 0% 

After the restart give_item (id, "weapon_knife"); Does not work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mahmoodi.1313
Senior Member
Join Date: Aug 2014
Location: Steamboat Springs, USA
Old 05-01-2015 , 05:07   After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #1

Hi
After the restart give_item (id, "weapon_knife"); Does not work .
PHP Code:
public knife(idlevelcid)
{
if(
cmd_access(id,levelcid1))
{
    new 
name[32]
    
get_user_info(id"name"name31)
    
strip_user_weapons(id)
        
give_item(id,"weapon_knife");
    
server_cmd("sv_restart 2");
    
server_cmd("sv_restart 3");
}
return 
PLUGIN_HANDLED

I need server_cmd("sv_restart 2"); , server_cmd("sv_restart 3"); and give_item(id,"weapon_knife");
mahmoodi.1313 is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 05-01-2015 , 07:39   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #2

Quote:
Originally Posted by mahmoodi.1313 View Post
Hi
After the restart give_item (id, "weapon_knife"); Does not work .
PHP Code:
public knife(idlevelcid)
{
if(
cmd_access(id,levelcid1))
{
    new 
name[32]
    
get_user_info(id"name"name31)
    
strip_user_weapons(id)
        
give_item(id,"weapon_knife");
    
server_cmd("sv_restart 2");
    
server_cmd("sv_restart 3");
}
return 
PLUGIN_HANDLED

I need server_cmd("sv_restart 2"); , server_cmd("sv_restart 3"); and give_item(id,"weapon_knife");
PHP Code:
strip_user_weapons(id)
    
give_item(id"weapon_knife"
-->
PHP Code:
if(is_user_alive(id))
{
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")

btw why do you need to get user name while you don't have anything to deal with it ?
__________________

Last edited by Shiina.Mashiro; 05-01-2015 at 07:39.
Shiina.Mashiro is offline
mahmoodi.1313
Senior Member
Join Date: Aug 2014
Location: Steamboat Springs, USA
Old 05-01-2015 , 07:54   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #3

not work !
PHP Code:
public knife(idlevelcid)
{
if(
cmd_access(id,levelcid1))
{
    new 
name[32]
    
get_user_info(id"name"name31)
    if(
is_user_alive(id))
    {
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")
    } 
    
server_cmd("sv_restart 2");
    
server_cmd("sv_restart 3");
}
return 
PLUGIN_HANDLED

Yes, But sometimes writes the name of the player rather than admin .
Code :
PHP Code:
public knife(idlevelcid)
{
if(
cmd_access(id,levelcid1))
{
    new 
name[32]
    
get_user_info(id"name"name31)
    if(
is_user_alive(id))
    {
    
strip_user_weapons(id)
    
give_item(id"weapon_knife")
    } 
    
server_cmd("sv_restart 2");
    
server_cmd("sv_restart 3");
    
ColorChat(0BLUE,"%s: Join . . .",name);
}
return 
PLUGIN_HANDLED

mahmoodi.1313 is offline
Kz1.0
Senior Member
Join Date: Jan 2013
Location: Vietnam
Old 05-01-2015 , 09:14   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #4

Dont understand what you want and what you are trying to do... ._.
Kz1.0 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 05-01-2015 , 09:21   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #5

post full code for more support
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
mahmoodi.1313
Senior Member
Join Date: Aug 2014
Location: Steamboat Springs, USA
Old 05-01-2015 , 09:45   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #6

The problems :
1. Sometimes the admin name instead of the name of the player writes .
PHP Code:
ColorChat(0GREEN,"%s: test",name); 
2. After the restart give_item (id, "weapon_knife"); Does not work .
PHP Code:
public knife(idlevelcid

if(
cmd_access(id,levelcid1)) 

    new 
name[32
    
get_user_info(id"name"name31
    
strip_user_weapons(id
        
give_item(id,"weapon_knife"); 
    
server_cmd("sv_restart 2"); 
    
server_cmd("sv_restart 3"); 

return 
PLUGIN_HANDLED 

The full code in the file.

Last edited by mahmoodi.1313; 05-01-2015 at 14:01.
mahmoodi.1313 is offline
Shiina.Mashiro
Senior Member
Join Date: Sep 2014
Location: Vietnam
Old 05-01-2015 , 10:10   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #7

I think that the error occur because you didn't check if the player is alive or not, and the loose indentation warning.
__________________
Shiina.Mashiro is offline
Old 05-01-2015, 10:17
indraraj striker
This message has been deleted by indraraj striker. Reason: Doesn't make any sense at all :3
mahmoodi.1313
Senior Member
Join Date: Aug 2014
Location: Steamboat Springs, USA
Old 05-01-2015 , 10:22   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #8

Quote:
Originally Posted by indraraj striker View Post
you want show the player name ?
just put the name out side the cmd_access
PHP Code:
public knife(idlevelcid)  
{  
new 
name[32]  
get_user_info(id"name"name31)  
ColorChat(0GREEN,"%s: test",name);
if(
cmd_access(id,levelcid1))  
{  
    
strip_user_weapons(id)  
     
give_item(id,"weapon_knife");  
    
server_cmd("sv_restart 2");  
    
server_cmd("sv_restart 3");  
}  
return 
PLUGIN_HANDLED  

For second wait sometime i m going to test your code
No, Admin has to say the name of the show.
mahmoodi.1313 is offline
mahmoodi.1313
Senior Member
Join Date: Aug 2014
Location: Steamboat Springs, USA
Old 05-01-2015 , 10:27   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #9

Quote:
Originally Posted by Shiina.Mashiro View Post
I think that the error occur because you didn't check if the player is alive or not, and the loose indentation warning.
ty, Unfortunately, I did not understand.

Especially, this problem than all problems is important for me :
2. After the restart give_item (id, "weapon_knife"); Does not work .

Last edited by mahmoodi.1313; 05-01-2015 at 10:38.
mahmoodi.1313 is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 05-01-2015 , 12:44   Re: After the restart give_item (id, "weapon_knife"); Does not work
Reply With Quote #10

sadly my net was gone btw here you go
Tested and working
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <hamsandwich>

#define ACCESS ADMIN_CVAR
new bool:kniferound;

public 
plugin_init() {
    
RegisterHam(Ham_Spawn"player""Give_knife");
    
register_clcmd("say /knf","knife",ACCESS);
}

public 
knife(idlevelcid)  
{  
    if(
cmd_access(id,levelcid1))  
    {  
        
        new 
szName[33]
        
get_user_name(idszNamecharsmax(szName));
        
client_print(0,print_chat,"ADMIN %s started knife round",szName)
        
//server_print("ADMIN %s started knife round",szName);
        
server_cmd("sv_restartround 3")
        
kniferound true;
    }  
    return 
PLUGIN_HANDLED  
}  

public 
Give_knife(id)
{
    if(
is_user_alive(id) && kniferound)
    {
        
strip_user_weapons(id)
        
give_item(id,"weapon_knife")
    }

Attached Files
File Type: sma Get Plugin or Get Source (test.sma - 609 views - 940 Bytes)
__________________
Thanks everyone. #miss_you_all
indraraj striker 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 02:57.


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