SERVER: Unknown Command when using a scripted command and it does execute! -
Moustafa - 19.07.2009
Hey guyz, i've made this command:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/epr", cmdtext, true, 10) == 0)
{
if (PlayerToPoint(1, playerid, -2660.8972,1423.4766,906.4609))
{
SetPlayerPos(playerid, -2660.8555,1425.6328,906.4609);
}
else
{
SendClientMessage(playerid, 0x00FFFF00, " You're not near any private room door ");
}
}
return 0;
}
Which is /epr, and when used near a position, it teleports him to another place, but when he is not near the position or any other one, he cannot use it..
So.. the problem is:
I enter the game, i get near the place, i type /epr and it teleports me to the other place, and it says SERVER: Unknown Command
And when i use /epr any place else so i can read You're not near any private room door, it shows me the text and it says SERVER: Unknown Command
I dunno how to fix that... if you can help me.. i will appreciate.
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
Jefff - 19.07.2009
return 1; U needed
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/epr", cmdtext, true) == 0)
{
if(PlayerToPoint(1.0, playerid, -2660.8972,1423.4766,906.4609))
{
SetPlayerPos(playerid, -2660.8555,1425.6328,906.4609);
}
else
{
SendClientMessage(playerid, 0x00FFFF00, " You're not near any private room door ");
}
return 1;
}
return 0;
}
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
Moustafa - 19.07.2009
Quote:
Originally Posted by Jefff
return 1; U needed
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/epr", cmdtext, true) == 0)
{
if(PlayerToPoint(1.0, playerid, -2660.8972,1423.4766,906.4609))
{
SetPlayerPos(playerid, -2660.8555,1425.6328,906.4609);
}
else
{
SendClientMessage(playerid, 0x00FFFF00, " You're not near any private room door ");
}
return 1;
}
return 0;
}
|
Worked.
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
Annihalation - 19.07.2009
fix your PlayerToPoint
it goes (PlayerID, Radius, X, Y, Z) thats the problem, it took me a while to figure that out :/
also, if your using it on a filterscript, and not the actual GameMode file, the server will think its a crazy command, but the filterscript wont

...
If it is in a filterscript, go to the GameMode file and put in, under OnPlayerCommandText:
Код:
if (strcmp("/epr", cmdtext, true)==0) return 1;
that should make it to where when you type /epr you dont get that "Unknown command" message thingy
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
Jefff - 19.07.2009
Quote:
Originally Posted by Annihalation
fix your PlayerToPoint
it goes (PlayerID, Radius, X, Y, Z) thats the problem, it took me a while to figure that out :/
|
Код:
stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
Annihalation - 20.07.2009
my stock beginning is different :P
stock PlayerToPoint(playerid, Radius, X, Y, Z);
Re: SERVER: Unknown Command when using a scripted command and it does execute! -
shabi rox - 11.06.2010
I change my return 0;
to return 1;
its worked