AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   newbie confused (https://forums.alliedmods.net/showthread.php?t=6920)

svendude 10-19-2004 07:19

newbie confused
 
ok i'm looking through all these easy scripts, and i see this thing

Code:
 {     if (!cmd_access(id,level,cid,2))     return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,8)     if (!player) return PLUGIN_HANDLED     new authid[32],authid2[32],name2[32],name[32]     get_user_authid(id,authid,31)     get_user_authid(player,authid2,31)     get_user_name(player,name2,31)     get_user_name(id,name,31)     return PLUGIN_HANDLED }

but what i don't understand is what the

Code:
 new arg[32]     read_argv(1,arg,31)
means, anyone know?

MC-Olivenoel 10-19-2004 07:35

hi

its n argument ...

example...

if u type in console

kick playerXYZ

Code:

new arg[32]
      read_argv(1,arg,31)


first makes n variable ;)
2. read the argument of the command kick ;)

here its playerXYZ

read_argv(1,arg,31)

1 = nummer of argument ( kick <arg1> <arg2> <arg3>)
arg = the variable where to put in the argument (arg = playerXYZ)
31 = how long is the argument (if its longer it will cut)


hope its correckt :?

cucu

svendude 10-19-2004 07:40

ok but whats an arg?

whats the basic layout for a block of code? Sorry if im ticking anyone of with my noobish but it will soon past, once you learn, u can't learn again... sorta

svendude 10-19-2004 07:50

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){     register_plugin("inviso","1.0","Carl/svendude")     register_concmd("amx_inviso","cmdinviso",ADMIN_BAN,"<name or #userid>")     return PLUGIN_continue } public cmdinviso(id, level, cid) {        if (!cmd_access(id,level,cid,2))        return PLUGIN_HANDLED

so far that's my whole plugin, but now im stuck, i don't know what to do from there. I know what the symtax is for what im doing but do i have to add any of that new arg [32] stuff?

MC-Olivenoel 10-19-2004 07:53

put arg only if u want to use arguments to config the plugin at runtime ;)

like

pause 1
pause 0

there u need n argument ;)

svendude 10-20-2004 03:53

ok thx, now i started small, just an easy rendering script:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){     register_plugin("inviso","1.0","Carl/svendude")     register_concmd("amx_inviso","cmdinviso",ADMIN_BAN,"<name or #userid>")     return PLUGIN_CONTINUE } public cmdinviso(id, level, cid) {        if (!cmd_access(id,level,cid,2))        return PLUGIN_HANDLED    set_user_rendering(index,kRenderTransTexture,255,0,0,kRenderNormal,25)    return PLUGIN_HANDLED }

now it says index is undefined, what does that mean? what slot i want it to be? what if i want it to be any slot?

ps: can you tell where my loose identity thingy is?

MC-Olivenoel 10-20-2004 04:27

hi

this index bug is esey ;)

set_user_rendering(index,kRenderTransTexture, 255,0,0,kRenderNormal,25)

the index is wrong

u must put n nummer there

index = nummer of player 0 - 31

if u put "0" there its the 1. player on server
if u put "2" there its the 2. player on server

if u put "id" there its the player witch is using the command ;)

u must replace index with id then its fine

breaddawson 10-20-2004 08:44

Quote:

if u put "2" there its the 2. player on server
:wink: maybe u want to say

if u put "1" there its the second player on server

i'm a newbie ,too
and i just want to know how the function worked u talked about
Code:

set_user_rendering(index,kRenderTransTexture,255,0,0,kRenderNormal,25)
yes, i saw the inc files
but i can't understand it

maybe when u use this,the player u specified will be looked in another color?

MC-Olivenoel 10-20-2004 08:55

OOOooo ups :roll:

ok 1 is 2. player ... LOL

now i'v no time to explain set_user_rendering :(

cucu

twistedeuphoria 10-20-2004 11:06

Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init(){ register_plugin("inviso","1.0","Carl/svendude") register_concmd("amx_inviso","cmdinviso",ADMIN_BAN,"<name or #userid>") return PLUGIN_CONTINUE } public cmdinviso(id, level, cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED set_user_rendering(id,kRenderTransTexture,255,0,0,kRenderNormal,25) return PLUGIN_HANDLED }
Alright, what this is gonna do is make the person who uses the command invisible(I think, don't know kRenderTransTexture). What you want to do is get the target player and to do that add this:
Code:
      new target[32],tid //Declare the variables    read_args(target,31) //<<<< Since you only have one thing that changes in the command (the player) you can read the whole string.    tid = cmd_target(id,target,8)  // A very useful function...check out the function area on the front page for flags.    if(!tid)  //Check if the player is valid       return PLUGIN_HANDLED
So add that right after your return if they don't have enough access and change "id" in set_user_rendering to "tid" and it should work correctly.


All times are GMT -4. The time now is 17:15.

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