SA-MP Forums Archive
Created Commands not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Created Commands not working (/showthread.php?tid=569123)



Created Commands not working - ThatThoseTheThy - 28.03.2015

Hello there,

I am editing a gamemode(NVCNR one) and I am trying to make a command, but for some reason what I make doesn't work.

I copied a command and changed the name, that worked but making one from scratch makes the server go:
"SERVER: Unknown Command"

here is a example of What I made:
PHP код:
CMD:copyCommand(playeridparams[])
{
    
SendClientMessageToAll(-1" 1 2 3 ... Testing ... ");
    return 
true;

not sure what is wrong, when I compile everything is fine except these warnings:

Код:
: warning 204: symbol is assigned a value that is never used: "s"
: warning 217: loose indentation
: warning 203: symbol is never used: "CountLogins"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
If you need more info ask I'll try to provide it.


Re: Created Commands not working - Oeal - 28.03.2015

Post any other FULL command from the gamemode please.


Re: Created Commands not working - ThatThoseTheThy - 28.03.2015

PHP код:
CMD:plus(playerid,params[])
{
    if(
PlayerInfo[playerid][aLevel] < 1) return SendClientMessage(playerid,RED,"Only admin level 1+ can use this command.");
    if(
HasSpawned{playerid} == false) return SendClientMessage(playeridRED"You must be spawned before you can use this command.");
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridRED"You cant use this command in a vehicle.");
    new 
coordinate[150], Float:distanceFloat:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if(
sscanf(params"s[150]f"coordinatedistance)) return SendClientMessage(playeridRED"[USAGE]: /plus [x/y/z] [distance]");
    if(
strfind(coordinate"x"false) != -1)
    {
        
SetPlayerPos(playeriddistanceyz);
    }
    else if(
strfind(coordinate"y"false) != -1)
    {
        
SetPlayerPos(playeridxdistancez);
    }
    else if(
strfind(coordinate"z"false) != -1)
    {
        
SetPlayerPos(playeridxydistance);
    }
    else
    {
        
SendClientMessage(playeridRED"The coord can only be x, y or z.");
    }
    return 
true;

This command makes you move your position


Re: Created Commands not working - CrossOv3r - 28.03.2015

Give us an example of your "scratch" commands.


Re: Created Commands not working - ThatThoseTheThy - 28.03.2015

[QUOTE=ThatThoseTheThy;3416018]


here is a example of What I made:
PHP код:
CMD:copyCommand(playeridparams[])
{
    
SendClientMessageToAll(-1" 1 2 3 ... Testing ... ");
    return 
true;




Re: Created Commands not working - maximthepain - 28.03.2015

Quote:
Originally Posted by ThatThoseTheThy
Посмотреть сообщение
Hello there,

I am editing a gamemode(NVCNR one) and I am trying to make a command, but for some reason what I make doesn't work.

I copied a command and changed the name, that worked but making one from scratch makes the server go:
"SERVER: Unknown Command"

here is a example of What I made:
PHP код:
CMD:copyCommand(playeridparams[])
{
    
SendClientMessageToAll(-1" 1 2 3 ... Testing ... ");
    return 
true;

not sure what is wrong, when I compile everything is fine except these warnings:

Код:
: warning 204: symbol is assigned a value that is never used: "s"
: warning 217: loose indentation
: warning 203: symbol is never used: "CountLogins"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
first warning if its related to the problem you can just use #pragma unused s beofre the return.
second one you should indent the warning line with this site http://codegenerators.pl/ easily just paste the code and click indent then recopy to the script.
What is this CountLogins? Its not even related to the issue i think.
Yes we need more info about what you were trying to do with that command?
and i think you should make it CMD:copycommand & you dont need actually params in this command so you can just CMD:copycommand(playerid), try this. and be sure you are including zcmd.inc.


Re: Created Commands not working - CrossOv3r - 28.03.2015

The only thing I can figure out, it's you are using uppercase at the command. Try: copycommand.


Re: Created Commands not working - ThatThoseTheThy - 28.03.2015

Quote:
Originally Posted by CrossOv3r
Посмотреть сообщение
The only thing I can figure out, it's you are using uppercase at the command. Try: copycommand.
That worked actually, I'm used to uppercase from coding with Adobe Flash CS6. Anyway thanks a bunch!



~Consider the Topic Closed~