Created Commands not working
#1

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.
Reply
#2

Post any other FULL command from the gamemode please.
Reply
#3

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
Reply
#4

Give us an example of your "scratch" commands.
Reply
#5

[QUOTE=ThatThoseTheThy;3416018]


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

Reply
#6

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.
Reply
#7

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

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~
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)