Command wont work! -
admantis - 17.12.2010
pawn Код:
#include <a_samp>
#include <a_players>
#include <a_objects>
#define PUTSPIKE 0x9ACD32AA
#define REMSPIKE 0xADFF2FAA
#define ERROR 0xAA3333AA
#define MAXSPIKES 30 // Max global spikes for your server.
new SpikesCount = 0;
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/createspike",cmdtext,true)==0)
{
new skin = GetPlayerSkin(playerid);
if (skin == 281 || skin == 282 || skin == 283 || skin == 288 || skin == 284
|| skin == 285 || skin == 286 || skin == 287 || skin == 265 || skin == 266
|| skin == 267 || skin == 280)
{
if (SpikesCount > MAXSPIKES) return SendClientMessage(playerid,ERROR,"ERROR: There is already too many spikes. Please remove some!");
else if(SpikesCount < MAXSPIKES)
{
new Float:X,Float:Y,Float:Z, Float:ang = GetPlayerFacingAngle(playerid,ang);
GetPlayerPos(playerid,X,Y,Z);
CreateObject(1593, X+1,Y-2,Z-0.1,ang,0,0);
SpikesCount++;
SendClientMessage(playerid,PUTSPIKE,"INFO: You have placed a spike strip at your location.");
return 1;
}
}
else return SendClientMessage(playerid,ERROR,"ERROR: You are not a police officer!");
}
return 0;
}
But when I type /createspike in game it says 'SERVER: Unknown command'
P.S: This is not my whole script only the most important part
P.S: It's a filterscript.
P.S EDIT: No errors nor warnings with the pawn compiler
PLEASE try to help me. And THANKS to whoever does it.
Re: Command wont work! -
Benjo - 17.12.2010
Are you running any other filterscripts with your server? If so, make sure that by default they are returning 0 in any OnPlayerCommandText callbacks. I'm pretty sure the code you have shown us looks solid and should work standalone.
Re: Command wont work! -
admantis - 17.12.2010
Quote:
Originally Posted by Benjo
Are you running any other filterscripts with your server? If so, make sure that by default they are returning 0 in any OnPlayerCommandText callbacks. I'm pretty sure the code you have shown us looks solid and should work standalone.
|
No.
My server.cfg file.
Код:
echo Executing Server Config...
lanmode 0
rcon_password changepass
maxplayers 30
port 7777
hostname Test
gamemode0 bare
filterscripts stripescreator
announce 1
query 1
weburl www.sa-mp.com
maxnpc 0
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
Any heap?
Re: Command wont work! -
Benjo - 17.12.2010
Is there any more to your OnPlayerCommandText callback in your filterscript? I'm not really too sure where else to look :S!
Re: Command wont work! -
admantis - 17.12.2010
Quote:
Originally Posted by Benjo
Is there any more to your OnPlayerCommandText callback in your filterscript? I'm not really too sure where else to look. :S!
|
No man, look by yourself.
Pastebin:
http://pastebin.com/NgjmTDdc
Re: Command wont work! -
Benjo - 17.12.2010
I just tried your filterscript as it is along with a blank gamemode and it worked fine. Are you definitely putting in the correct command "/createspike"? (just asking cus I noticed you had called the file stripescreator so thought there's a possibility of you accidentally doing /createstripe - don't mean to sound patronising!).
One thing I've done in the past is not realise I have two versions of the same file up at the same time. I had been editing one, compiling it (in the wrong place) and being stuck for hours wondering why nothing would work when I loaded the server. Only to kick myself when I realised I was editing the wrong saved file! XD
If this doesn't help you, I have no idea what to suggest >_<
Re: Command wont work! -
admantis - 17.12.2010
I tried testing it in a BLANK script instead of the bare script. It worked, thanks to your tips and help
Thank you !
Re: Command wont work! -
Benjo - 17.12.2010
Excellent! I'm not exactly sure where the conflict was but I'm glad it's resolved
And if anybody can give any possible reasons for the error, then don't hesitate to enlighten me
Re: Command wont work! -
admantis - 17.12.2010
Quote:
Originally Posted by Benjo
Excellent! I'm not exactly sure where the conflict was but I'm glad it's resolved And if anybody can give any possible reasons for the error, then don't hesitate to enlighten me
|
Actually now its not. Read your PM inbox.
Re: Command wont work! -
Benjo - 17.12.2010
Hmm, I just tried the updated filterscript that you PMed me out and it still seems fine to me. I typed /createspike 30 times and it creates 30 spikes. If I type it after that, it says in red writing "ERROR: Too many spikes placed. Please remove some!", which is working correctly. I don't know what to suggest, but I'll post the exact gamemode and server config I am using -
Server.cfg
Код:
echo Executing Server Config...
lanmode 0
rcon_password imsecretlygay
maxplayers 24
port 7777
hostname BareScript
gamemode0 bare 1
filterscripts stripescreator
announce 0
query 1
weburl www.sa-mp.com
plugins
onfoot_rate 40
incar_rate 40
weapon_rate 40
stream_distance 300.0
stream_rate 1000
maxnpc 12
Gamemode (default bare.pwn found in gamemodes folder):
http://pastebin.com/MuJq8PGJ
I am running the pre-release of 0.3c, but it really shouldn't make a difference to 0.3b in this case. Sorry I can't offer any more help!