AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Making my own Phone Mod (TSRP) (https://forums.alliedmods.net/showthread.php?t=12015)

[cTs] Strake*ROC* 04-02-2005 22:17

Making my own Phone Mod (TSRP)
 
I cant find Phone Mod for TSRP anywhere, so i decided to make my own... could you guys tell me if anything is wrong with what i have so far? I am almost 99% sure there is, but i dont exactly know what....

Code:
/* AMX Mod X script. * * (c) 2004, Strake * This file is provided as is (no warranties). */ #include <amxmodx> #include <amxmisc> // Define new talkingto[33]; new calling[33]; public plugin_init(){     register_plugin("Template","1.0","Strake")     register_clcmd("say", "handle_say") } public handle_say(id) { new message; new command; read_data(2, command) if (command == "/call") { new arg2[52]; read_argv(2, arg2, 51); get_user_name(target, targetname, 51);     client_print(target, print_chat, "[Phone Mod] Your Phone is Ringing!")     client_print(target, print_chat, "[Phone Mod] Say ^"/answer^" to answer your phone.")     calling[target] == 1    } if (command == "/answer") { new arg2[52]; read_argv(2, arg2, 51); new target = cmd_target(id,arg2,3);     if (calling[id] == 1) {         talkingto[target] = 1         talkingto[id] = 1         calling[target] = 0     }     else {         client_print(id, print_chat, "[Phone Mod] Your Phone Is Not Ringing.")     } } // Note: Save Message as Message Said if (talkingto[target] == 1) { new arg2[52]; read_argv(2, arg2, 51); new target = cmd_target(id,arg2,3);     client_print(target, print_chat, "[Phone Mod] %s", message) } }

smdobay 04-03-2005 01:23

Maybe I'm missing something, but where does the transfer from arg2 to target occur in the /call statement?

Quote:

Code:
if (command == "/call") { new arg2[52]; read_argv(2, arg2 <-------    , 51); get_user_name(target <------  ?, targetname, 51);     client_print(target, print_chat, "[Phone Mod] Your Phone is Ringing!")     client_print(target, print_chat, "[Phone Mod] Say ^"/answer^" to answer your phone.")     calling[target] == 1     }

Again, maybe I missed it, but if you're using read_argv into a variable arg2 but fining a user with an unassigned variable, I'd wonder where the magical data assignment occurs.

[cTs] Strake*ROC* 04-03-2005 01:34

This is what i have now, compiles fine, working on testing it now....:

Code:
/* AMX Mod X script. * * (c) 2004, Strake * This file is provided as is (no warranties). */ #include <amxmodx> #include <amxmisc> // Define new talkingto[33] = 0; new calling[33] = 0; public plugin_init(){     register_plugin("Template","1.0","Strake")     register_clcmd("say", "handle_say") } public handle_say(id) { new message; new command[101]; read_argv(1, command, 100); if(equali(command,"/call") == 1) { new arg2[52]; read_argv(2, arg2, 51); new target = cmd_target(id,arg2,3);     client_print(target, print_chat, "[Phone Mod] Your Phone is Ringing!")     client_print(target, print_chat, "[Phone Mod] Say ^"/answer^" to answer your phone.")     calling[target] = 1 } if(equali(command,"/answer") == 1) { new arg2[52]; read_argv(2, arg2, 51); new target = cmd_target(id,arg2,3);     if (calling[id] == 1) {         talkingto[target] = 1         talkingto[id] = 1         calling[target] = 0     }     else {         client_print(id, print_chat, "[Phone Mod] Your Phone Is Not Ringing.")     } } // Note: Save Message as Message Said if (talkingto[id] == 1) { new arg2[52]; read_argv(2, arg2, 51); new target = cmd_target(id,arg2,3);     client_print(target, print_chat, "[Phone Mod] %s", message) } if(equali(command,"/hangup") == 1) { new arg2[52]; read_argv(2, arg2, 51); new target = console_cmd(id,arg2,3); calling[id] = 0 talkingto[target] = 0 } }


All times are GMT -4. The time now is 09:49.

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