Raised This Month: $51 Target: $400
 12% 

need help, dumb problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
danware
Junior Member
Join Date: Sep 2007
Old 09-08-2007 , 13:47   need help, dumb problem
Reply With Quote #1

Hi, I have created an awsome sub app for cs source to call an admin to the game. It litterally calls my phone using a linux asterisk phone server, and a S.A.R.A. server (own design for the networks i manage). All works flawlessly there, the only issue I have is getting the game to say "An admin has been called, please stand by." I'm having a hard time getting sourcemod to recognize my little file, I could use your help.

calladmin.sp:
public OnPluginStart(){ RegConsoleCmd("say", Command_Say)} public Action:Command_Say(client, args){ new String:text[192] GetCmdArgString(text, sizeof(text)) new startidx = 0 if (text[0] == '"') { startidx = 1 /* Strip the ending quote, if there is one */ new len = strlen(text); if (text[len-1] == '"') { text[len-1] = '\0' } } if (StrEqual(text[startidx], "getadmin")) { PrintToConsole(client, "Friendly fire is enabled.") } /* Let say continue normally */ return Plugin_Continue} thanks for your help
danware is offline
danware
Junior Member
Join Date: Sep 2007
Old 09-08-2007 , 13:49   Re: need help, dumb problem
Reply With Quote #2

sorry, lets try
calladmin.sp:
<pre>
public OnPluginStart(){ RegConsoleCmd("say", Command_Say)} public Action:Command_Say(client, args){ new String:text[192] GetCmdArgString(text, sizeof(text)) new startidx = 0 if (text[0] == '"') { startidx = 1 /* Strip the ending quote, if there is one */ new len = strlen(text); if (text[len-1] == '"') { text[len-1] = '\0' } } if (StrEqual(text[startidx], "getadmin")) { PrintToConsole(client, "Friendly fire is enabled.") } /* Let say continue normally */ return Plugin_Continue}</pre>
danware is offline
danware
Junior Member
Join Date: Sep 2007
Old 09-08-2007 , 13:50   Re: need help, dumb problem
Reply With Quote #3

HTML Code:
<pre>
public OnPluginStart(){	RegConsoleCmd("say", Command_Say)} public Action:Command_Say(client, args){	new String:text[192]	GetCmdArgString(text, sizeof(text)) 	new startidx = 0	if (text[0] == '"')	{		startidx = 1		/* Strip the ending quote, if there is one */		new len = strlen(text);		if (text[len-1] == '"')		{			text[len-1] = '\0'		}	} 	if (StrEqual(text[startidx], "getadmin"))	{	PrintToConsole(client, "Admin has been called.")		} 	/* Let say continue normally */	return Plugin_Continue}</pre>
danware is offline
dalto
Veteran Member
Join Date: Jul 2007
Old 09-08-2007 , 14:05   Re: need help, dumb problem
Reply With Quote #4

So, the code is pretty hard read without any line breaks but the obvious question to ask is are you compiling it?
dalto is offline
spelworm
Senior Member
Join Date: Mar 2007
Old 09-08-2007 , 14:08   Re: need help, dumb problem
Reply With Quote #5

maybe try PrintToChatAll("Admin has been called.")

sorry cant help you if that wasnt it
spelworm is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 09-08-2007 , 14:09   Re: need help, dumb problem
Reply With Quote #6

Hm... A thing I noticed that does not work that way

new String:str[32];
str = "abcAbcAbc";

str[0] will not be equal to "a", but rather "AbcAbcAbc"
str[1] will be equal to "bcAbcAbc"
str[2] will be equal to "cAbcAbc"
and so on...
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
dalto
Veteran Member
Join Date: Jul 2007
Old 09-08-2007 , 15:00   Re: need help, dumb problem
Reply With Quote #7

Quote:
Originally Posted by Nican View Post
Hm... A thing I noticed that does not work that way

new String:str[32];
str = "abcAbcAbc";

str[0] will not be equal to "a", but rather "AbcAbcAbc"
str[1] will be equal to "bcAbcAbc"
str[2] will be equal to "cAbcAbc"
and so on...
Actually str[0] will be equal to 'a' and "abcAbcAbc"
dalto is offline
BAILOPAN
Join Date: Jan 2004
Old 09-08-2007 , 15:30   Re: need help, dumb problem
Reply With Quote #8

dalto's correct -- what you're seeing is that Pawn passes things by reference. So if you have an array str[X] and you pass it to another array as str[Y], internally you're passing the upper half of the array str[Y...X-1].

But if you pass by value, of course, you just get str[Y].
__________________
egg
BAILOPAN is offline
danware
Junior Member
Join Date: Sep 2007
Old 09-08-2007 , 17:54   Re: need help, dumb problem
Reply With Quote #9

got it fixed, thanks guys!!!
danware is offline
danware
Junior Member
Join Date: Sep 2007
Old 09-08-2007 , 19:24   Re: need help, dumb problem
Reply With Quote #10

Got it working, works quick and like a charm, sends message to client, and call my cell phone upon a chat catch of `get admin`. This little smx plugin just responds to the get admin cmd, and sends back `the on-call admin has been contacted, please stand by` my (outside) app does the rest.

So, if any one wants it, i wrote a small vb6 app to catch all log traffic, and fire off another udp packet to another server, that catches the message (or error as this is), error checked against a sql server, told to place a call on the asrterisk phone server, to call my cell phone. Alot of work for a simple feature, but very powerful. At this point I can only give away the small app the catches server logs.
danware is offline
Reply



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 22:10.


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