AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   1 func choosing, 1 func using (https://forums.alliedmods.net/showthread.php?t=17277)

Obbin 08-28-2005 16:41

1 func choosing, 1 func using
 
How to make one function that chooses an player (nick/steamid), and one function that uses an function width that player?

example (console):

amx_choose Obbin
[AMXx] You choosen Obbin!
amx_chooseexec "say AMXx owns"
Obbin: AMXx owns

Hawk552 08-28-2005 16:56

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("AMXX Choose","1.0","Hawk552")     register_concmd("amx_choose","choose",ADMIN_BAN," <player> - chooses the player to say 'AMXX Owns'") } public choose(id,level,cid) {     if(!cmd_access(id,level,cid,2))     {         return PLUGIN_HANDLED     }         new arg[32]     read_argv(1,arg,31)     new target = cmd_target(id,arg,1)         if(!target)     {         return PLUGIN_HANDLED     }         client_cmd(target,"say AMXX Owns!")         return PLUGIN_HANDLED }

EDIT: Use Exec 2 by v3x, it's a lot better.

pdoubleopdawg 08-28-2005 17:02

WRONG ^^^

lastfunction(id) {
function(id,informationfromlastfunction)
}

function(id,informationfromlastfunction) {
client_print(0,print_chat,informationfromlast function)
}

XxAvalanchexX 08-28-2005 20:35

In the first function store the player's id in a variable, in the second function use the stored player's id.

Obbin 08-29-2005 02:40

thx avalanche!

darkcloud9sgl 08-29-2005 08:08

wow nice job avalanche

Obbin 08-29-2005 11:31

hmm. when i create an variable in one func and then uses it in 'nother func compiler says "unidentifined sypbol"

v3x 08-29-2005 13:25

Code? ;]

Xanimos 08-29-2005 14:04

Make a global var not one in the first function


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

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