AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Various problems (https://forums.alliedmods.net/showthread.php?t=183)

devicenull 03-10-2004 17:38

Various problems
 
I've decided to make one thread about the problems I have, instead of 10
So any future problems I have will go here :)

So, I want to get all the arguments after a certain one..
like the command is "say hello and die" I want to be able to get "hello and die" from that - but the trick is it has to work for "say hello and how are you", and get "hello and how are you"
Any Suggestions?
The other problem is - I dont know why this doesnt work:
Code:
new pid = find_player("abcdl",username) if (!pid) {     client_print(id,print_chat,"[NSX] No such user")     return PLUGIN_HANDLED }
username is a variable that has what the user inputted, part of a name, a steamid, whatever - it *always* says user not found

And is this the correct way to switch about the cvar?
Code:
    switch(get_cvar_num("amx_show_activity"))     {         case 1: client_print(0,print_chat,"[NSX] Admin used command nsx_uncomm %s",targetname)         case 2: client_print(0,print_chat,"[NSX] %s used command nsx_uncomm %s",username,targetname)     }
That *should* check amx_show_activity, and display the proper one, but it doesnt display anything, and I DO NOT SEE amx_show_activity with amxx cvars

_KaszpiR_ 03-11-2004 03:16

i can post from old amx ones
1. i use this one
Code:
public playtime_say(id){    new speech[192]    new query[33]    read_args(speech,192)    remove_quotes(speech) //   client_print(id,print_console,"[AMX] PlayTime - DEbug s '%s'", speech)    new i = 0    if(equal(speech,"/playtimetop", 12))         playtime_report(id,"",1)    else if(equal(speech,"/playtime", 9))    {      while(speech[10+i]){//copying the rest of the say text as a query text (without /playtime)            query[i] = speech[10+i]            i++      } //      client_print(id,print_console,"[AMX] PlayTime - Debug q '%s'", query)      if(!strlen(query))     get_user_name(id,query,32) //      client_print(id,print_console,"[AMX] PlayTime - Debug q2 '%s'", query)      playtime_report(id,query)    //playtime_report(id,speech[10])    }    return PLUGIN_CONTINUE //the say text can be parsed by other plugins so use plugin_continue }
the say command contains 1 arg - the string after
say "anythign here utill enter pressed"

and in the plugin i get that argument and the check
if it contains /playtime or /playtimetop
if playtimetop -run fuction with different parameters
if playtime and after that there are not text then run funtion with player name partameter (as a query)
otherwise run funtion ith the rest of the string

complete source at http://info.wsisiz.edu.pl/~sochon/do...l_playtime.sma

2. the admin.sma will help you for sure, there are the best examples of finding the players

3. better
new num = get_cvar_num(...)
then round it and finally use switch
here i suggest adminmenu.sma addon


All times are GMT -4. The time now is 16:59.

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