Raised This Month: $ Target: $400
 0% 

help for scripting code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smartsl
Junior Member
Join Date: Apr 2004
Old 05-11-2004 , 07:27   help for scripting code
Reply With Quote #1

Hi, developer. i used the Amx Match Deluxe 1.71 plugin of amxmodx in cs1.6. But i found the command "amx_swapteams" didn't work at all. i have seen the relative source code:
Code:
public swap()
{
new playersCT[32]
new playersT[32]
new nbrCT,nbrT
get_players(playersCT,nbrCT,"e","CT")
get_players(playersT,nbrT,"e","TERRORIST")
for(new i = 0; i < nbrCT; i++) {
  engclient_cmd(playersCT[i], "chooseteam")
  engclient_cmd(playersCT[i], "menuselect", "1")
  if (is_user_bot(playersCT[i]))
   engclient_cmd(playersCT[i], "menuselect", "2")
  else
   client_cmd(playersCT[i], "slot2")
}
for(new i = 0; i < nbrT; i++) {
  engclient_cmd(playersT[i], "chooseteam")
  engclient_cmd(playersT[i], "menuselect", "2")
  if (is_user_bot(playersT[i]))
   engclient_cmd(playersT[i], "menuselect", "4")
  else
   client_cmd(playersT[i], "slot4")
}
return PLUGIN_CONTINUE
}
i didn't understand the SMALL Programming Language, it's so different from C/C++. i didn't know what does "engclient_cmd" "is_user_bot" mean exactly, so i read the 'amxmodx.inc'. After that, i thought the code above has no errors.

Is there some one can help me and tell me how to let the swap function work in cs1.6?
smartsl is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-11-2004 , 09:10  
Reply With Quote #2

at the moment, it is not sure whether engclient_cmd actually works on steam. I heard it doesn't but havent had time to test it yet...
__________________
hello, i am pm
PM is offline
BAILOPAN
Join Date: Jan 2004
Old 05-11-2004 , 14:32  
Reply With Quote #3

It works, but not for everything... use client_cmd
__________________
egg
BAILOPAN is offline
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 05-11-2004 , 21:40  
Reply With Quote #4

whats the diffrence exactly :-|
__________________
QwertyAccess is offline
Ingram
Veteran Member
Join Date: May 2004
Old 05-11-2004 , 22:35  
Reply With Quote #5

client_cmd makes it so the client types the command in their console, allowing plugins to "intercept" the command

engclient_cmd just runs the command on the client, without sending it to them to run
Ingram is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 05-11-2004 , 22:42  
Reply With Quote #6

Quote:
Originally Posted by JJkiller
client_cmd makes it so the client types the command in their console, allowing plugins to "intercept" the command

engclient_cmd just runs the command on the client, without sending it to them to run
Basically... But remember that engclient is run by the server, where the client is fully unaware of it
Normal client_cmd is sent to the client to then execute.... So a users settings would never be effected by engclient, but englclient eliminates the server->client->server lag time
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
Ingram
Veteran Member
Join Date: May 2004
Old 05-11-2004 , 22:58  
Reply With Quote #7

Also, since engclient_cmd might not work, maybe u should change it to
Code:
public swap() { new playersCT[32] new playersT[32] new nbrCT,nbrT get_players(playersCT,nbrCT,"ce","CT") get_players(playersT,nbrT,"ce","TERRORIST") for(new i = 0; i < nbrCT; i++) {   client_cmd(playersCT[i], "jointeam 1")   client_cmd(playersCT[i], "slot1") } for(new i = 0; i < nbrT; i++) {   client_cmd(playersT[i], "jointeam 2")   client_cmd(playersT[i], "slot1") } return PLUGIN_CONTINUE }
but the bots won't change teams...
Ingram is offline
smartsl
Junior Member
Join Date: Apr 2004
Old 05-12-2004 , 04:20  
Reply With Quote #8

Thx JJkiller, i modified some of ur codes like this:
Code:
get_players(playersCT,nbrCT,"e","CT") get_players(playersT,nbrT,"e","TERRORIST") ... client_cmd(playersCT[i], "jointeam 1") client_cmd(playersCT[i], "wait") client_cmd(playersCT[i], "slot2") ...
i added the 'wait' command, so that the menu in client's screen would be cleared.

Another problem is that when i used the plugin in cs:cz with official_cs_bot_v1.5, the bot wouldn't response.

i have a question yet: where the "jointeam" cmd is? It's neither the cs_console_cmd nor amx_any_function, i couldn't find it out. Of course, it works fine just like "chooseteam & menuselect".
smartsl is offline
smartsl
Junior Member
Join Date: Apr 2004
Old 05-12-2004 , 05:38  
Reply With Quote #9

For a long-time study, i find the small language is so great. i have solved the official_bots prob. Here's my solution:
Code:
//BOT new nbbCT,nbbT new botsCT[32][32],botsT[32][32] public swap() {     new playersCT[32]     new playersT[32]     new nbrCT,nbrT     new name[32]     get_players(playersCT,nbrCT,"e","CT")     get_players(playersT,nbrT,"e","TERRORIST")     nbbCT=0     for(new i = 0; i < nbrCT; i++) {         if (is_user_bot(playersCT[i]))         {             get_user_name(playersCT[i],name,31)             server_cmd("bot_kick %s",name)             botsCT[nbbCT++]=name         }else         {             client_cmd(playersCT[i], "jointeam 1")             client_cmd(playersCT[i], "wait")             client_cmd(playersCT[i], "slot2")           }     }     nbbT=0     for(new i = 0; i < nbrT; i++) {         if (is_user_bot(playersT[i]))         {             get_user_name(playersT[i],name,31)             server_cmd("bot_kick %s",name)             botsT[nbbT++]=name         }else         {             client_cmd(playersT[i], "jointeam 2")             client_cmd(playersT[i], "wait")             client_cmd(playersT[i], "slot4")            }     }     set_task(0.5,"swap2")     return PLUGIN_CONTINUE } public swap2() {     for(new i = 0; i < nbbCT; i++)     {         server_cmd("bot_add_t %s",botsCT[i])     }     for(new i = 0; i < nbbT; i++)     {         server_cmd("bot_add_ct %s",botsT[i])     }     return PLUGIN_CONTINUE }
smartsl is offline
Reply


Thread Tools
Display Modes

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 16:48.


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