Commands problem
#1

Hi guys,
So I have a small command problem.
The cmds that I have created don't work except /kill(in the gamemode) and /weps (weapon menu, filterscript).
Here's the whole GM.
http://pastebin.com/vpHDveRw
Rep+ rewarded for the help!
Reply
#2

just show us the commands , not the whole gm

nvm.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/heal", cmdtext, true, 5) == 0)
        {
            SetPlayerHealth(playerid, 100);
            SetPlayerArmour(playerid, 100);
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Your health and armor have been fully restored.");
        }
        if (strcmp("/kill", cmdtext, true, 5) == 0)
        {
            SetPlayerHealth(playerid, 0);
        }
        if (strcmp("/rweps", cmdtext, true, 6) == 0)
        {
            ResetPlayerWeapons(playerid);
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Your weapons have been reset.Use /weps for new ones.");
        }
        if (strcmp("/cmds", cmdtext, true, 5) == 0)
        {
            SendClientMessage(playerid, 0x0FFDD349, "pm>>/rweps, /kill, /heal, /rules, /weps, /teles");
        }
        if (strcmp("/rules", cmdtext, true, 6) == 0)
        {
            SendClientMessage(playerid, 0x0FFDD349, "pm>>x-x-x-x-Server rules-x-x-x-x");
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not insult other players and staff members.");
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not use hacks or tools that give you unfair advantage over others.");
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not advertise other servers.");
            SendClientMessage(playerid, 0x0FFDD349, "pm>>Not following these rules may lead you to being punished by the administrators");
            return 1;
        }
        return 1;
}
Reply
#3

Код:
 if (strcmp("/heal", cmdtext, true, 5) == 0)
        {
                SetPlayerHealth(playerid, 100);
                SetPlayerArmour(playerid, 100);
                SendClientMessage(playerid, 0x0FFDD349, "pm>>Your health and armor have been fully restored.");
                return 1;
        }
Код:
 if (strcmp("/kill", cmdtext, true, 5) == 0)
        {
            SetPlayerHealth(playerid, 0);
            return 1;
        }
You forgot to put return 1; and for command /kill you haved SetPlayerHealth(playerid, 100); wich increase you're health not killing you
Reply
#4

strange, i think it should work, don't see any problems with this code. it might be that you not are using return 1; at the heal command or that you are using
if (strcmp("/heal", cmdtext, true, 5) == 0)
instead of
if(!strcmp("/heal", cmdtext, true, 5))
I don't thought that would be a problem tho, but you cold test it.

Edit: I was a little late :S
Reply
#5

Or you can use zcmd with sscanf, it's much faster and more efficient.

[advice]
Reply
#6

Quote:
Originally Posted by CaRa
Посмотреть сообщение
Or you can use zcmd with sscanf, it's much faster and more efficient.

[advice]
yup, a fastest commands processer.
Reply
#7

Okay, so the code that Devilxz97 posted didn't fix the problem and still only /kill and /weps worked.
I downloaded zcmd + sscanf but it gives me this error:
Код:
D:\Rockstar Games\GTA San Andreas\samp03e_svr_R2_win32\gamemodes\ifgrandlarc.pwn(586) : warning 203: symbol is never used: "heal"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
here's my code:
Код:
CMD:heal(playerid, o[])
{
	SetPlayerHealth(playerid, 100);
	SetPlayerArmour(playerid, 100);
 	return 1;
}
And yes, I have zcmd in my pawno/includes folder.
Reply
#8

Use ZCMD for all comands you make.

warning 203: symbol is never used: "heal"

go to line 586 and remove it
Reply
#9

pawn Код:
CMD:heal(playerid, params[]) // it should be params[] not o[]
{
    SetPlayerHealth(playerid, 100);
    SetPlayerArmour(playerid, 100);
    return 1;
}
Reply
#10

Ok so I re-made them with zcmd, but they still don't work.
Код:
COMMAND:heal(playerid, params[])
{
		SetPlayerHealth(playerid, 100);
		SetPlayerArmour(playerid, 100);
		SendClientMessage(playerid, 0x0FFDD349, "pm>>Your health and armor have been fully restored.");
		return 1;
}

COMMAND:kill(playerid, params[])
{
		SetPlayerHealth(playerid, 0);
		return 1;
}

COMMAND:rweps(playerid, params[])
{
		ResetPlayerWeapons(playerid);
		SendClientMessage(playerid, 0x0FFDD349, "pm>>Your weapons have been reset.Use /weps for new ones.");
		return 1;
}

COMMAND:cmds(playerid, params[])
{
		SendClientMessage(playerid, 0x0FFDD349, "pm>>/rweps, /kill, /heal, /rules, /weps, /teles");
		return 1;
}

COMMAND:rules(playerid, params[])
{
		SendClientMessage(playerid, 0x0FFDD349, "pm>>x-x-x-x-Server rules-x-x-x-x");
	 	SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not insult other players and staff members.");
	  	SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not use hacks or tools that give you unfair advantage over others.");
	   	SendClientMessage(playerid, 0x0FFDD349, "pm>>Do not advertise other servers.");
	   	SendClientMessage(playerid, 0x0FFDD349, "pm>>Not following these rules may lead you to being punished by the administrators");
	    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)