AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Server Crash When I Type %s In Chat (https://forums.alliedmods.net/showthread.php?t=127834)

#8 SickneSS 05-25-2010 11:25

Server Crash When I Type %s In Chat
 
Code...

K.K.Lv 05-25-2010 11:51

Re: How I can select two player from two menus and give something from a bool
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
//Global
new bool:Player[33];
new 
PlayerIndex[33]
//Init
register_clcmd("say /menut","cmdMenuT");
//Menu
public cmdMenuT(id) {
 
 new 
players[32], playernum;
 
get_players(playersnum"ch""TERRORIST");//skip bots and hltv
 
new Menu menu_create("\rTerrorists \w:","HandlerT");
 
 for(new 
0;<= num;i++)
 {
  
player players[i];
   new 
name[32];
   
get_user_name(playername31);
   
   new 
temp[2];
   
num_to_str(i,temp,2);
   
   
menu_additem(Menu,name,temp);
 }
 
 
menu_display(id,Menu);
 return 
PLUGIN_HANDLED;
}
public 
HandlerT(id,Menu,item) {
 
 if(
item == MENU_EXIT)
 {
  
menu_destroy(Menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
iData[6];
 new 
iName[64];
 new 
Access;
 new 
Callback;
 
 
menu_item_getinfo(Menu,item,Access,iData,5,iName,63,Callback);
 
 new 
tempid str_to_num(iData)
 if(
is_user_alive(tempid))
 {
  new 
name[32];
  
get_user_name(id,name,31);
  
  
Player[tempid] = true;
  
client_print(0,print_chat,"ADMIN %s sets the Player %s to true",name,iName);
  
  
cmdMenuCT(id);
  
PlayerIndex[id] = tempid
 
}
 return 
PLUGIN_HANDLED;
}
public 
cmdMenuCT(id) {
 
 new 
players[32], playernum;
 
get_players(playersnum"ch""CT");//skip bots and hltv
 
new Menu menu_create("\rCounter-Terrorists \w:","HandlerCT");
 
 for(new 
0;<= num;i++)
 {
  
player players[i];
   new 
name[32];
   
get_user_name(player,name,31);
   
   new 
temp[2];
   
num_to_str(i,temp,2);
   
   
menu_additem(Menu,name,temp);
  }
 }
 
 
menu_display(id,Menu);
 return 
PLUGIN_HANDLED;
}
public 
HandlerCT(id,Menu,item) {
 
 if(
item == MENU_EXIT)
 {
  
menu_destroy(Menu);
  return 
PLUGIN_HANDLED;
 }
 
 new 
iData[6];
 new 
iName[64];
 new 
Access;
 new 
Callback;
 
 
menu_item_getinfo(Menu,item,Access,iData,5,iName,63,Callback);
 
 new 
tempid str_to_num(iData)
 if(
is_user_alive(tempid))
 {
  new 
name[32];
  
get_user_name(id,name,31);
  
  
Player[PlayerIndex[id]] = true;
  
client_print(0,print_chat,"ADMIN %s sets the Player %s to true",name,iName);
  
 }
 return 
PLUGIN_HANDLED;
}
//New Function
public Funtion(id) {
 if(
Player[id))

 
//Do this
}
return 
PLUGIN_HANDLED;


Untest ! if work tell me !!

fysiks 05-25-2010 14:56

Re: How I can select two player from two menus and give something from a bool
 
Quote:

Originally Posted by #8 SickneSS (Post 1190909)
I Have a new problem,I don't know why,but when i use %s in chat,the server goes down and when i'm dead doesn't works the colours.

Where?

fysiks 05-25-2010 15:00

Re: How I can select two player from two menus and give something from a bool
 
Quote:

Originally Posted by #8 SickneSS (Post 1190921)
In Game

Thank you captain obvious! Where in the code.

#8 SickneSS 05-25-2010 18:24

Re: Server Crash When I Type %s In Chat
 
New Title and New Problem

Exolent[jNr] 05-25-2010 18:33

Re: Server Crash When I Type %s In Chat
 
... Don't change your topic from one problem to another.

#8 SickneSS 05-25-2010 18:38

Re: Server Crash When I Type %s In Chat
 
Ok,but i solved the 1st Problem,and to dont make a new thread i change the thopic title.

Exolent[jNr] 05-25-2010 18:40

Re: Server Crash When I Type %s In Chat
 
So make a new thread.
Each thread should contain one issue.

#8 SickneSS 05-25-2010 18:42

Re: Server Crash When I Type %s In Chat
 
Ok,next time I will make a new thread.Sorry.About the code,can you help me?

EDIT :
Solved by my self the answer is
Code:
replace_all(said,191,"%s","s");

K.K.Lv 05-25-2010 21:31

Re: Server Crash When I Type %s In Chat
 
Suggestion:

just use
PHP Code:

new players[32], playernum;
 
get_players(playersnum"ch""TERRORIST");
//or
 
get_players(playersnum"ch""CT"); 

and the
PHP Code:

if(is_user_connected(Index) && cs_get_user_team(Index) == CS_TEAM_T

is unnecessary


All times are GMT -4. The time now is 05:24.

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