AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   After the restart give_item (id, "weapon_knife"); Does not work (https://forums.alliedmods.net/showthread.php?t=262261)

mahmoodi.1313 05-01-2015 05:07

After the restart give_item (id, "weapon_knife"); Does not work
 
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");

Shiina.Mashiro 05-01-2015 07:39

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

Originally Posted by mahmoodi.1313 (Post 2292070)
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 ?

mahmoodi.1313 05-01-2015 07:54

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
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



Kz1.0 05-01-2015 09:14

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
Dont understand what you want and what you are trying to do... ._.

indraraj striker 05-01-2015 09:21

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
post full code for more support

mahmoodi.1313 05-01-2015 09:45

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
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.

Shiina.Mashiro 05-01-2015 10:10

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
I think that the error occur because you didn't check if the player is alive or not, and the loose indentation warning.

mahmoodi.1313 05-01-2015 10:22

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

Originally Posted by indraraj striker (Post 2292172)
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 05-01-2015 10:27

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

Originally Posted by Shiina.Mashiro (Post 2292167)
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 .

indraraj striker 05-01-2015 12:44

Re: After the restart give_item (id, "weapon_knife"); Does not work
 
1 Attachment(s)
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")
    }




All times are GMT -4. The time now is 20:14.

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