How do I duplicate commands in PAWNO? /heal = /hp
#1

For instance, /heal and /hp will be the same thing. I just don't want to copy paste the block of code and replace the user-input command to /hp.
Reply
#2

what kind of command processor do you use??
ex:
dcmd?
zcmd?
y_commands?
or just the onplayercommand callback
Reply
#3

Assuming Heal is the main command:
dcmd:
pawn Код:
dcmd_hp(playerid, params[]) return dcmd_heal(playerid, params);
//Place this under all of your commands with dcmd
zcmd:
pawn Код:
CMD:hp(playerid,params[])
{
    return cmd_heal(playerid,params);
}
//I generally place these right under the command itself.
ycmd:
pawn Код:
Command_AddAltNamed("heal", "hp");
//Place This Under OnGamemodeInit
strcmp:
pawn Код:
if((strcmp("/heal", cmdtext, true) == 0) || (strcmp("/hp", cmdtext, true) == 0))
//Use this under OnPlayerCommandText
Reply
#4

I just use the default strcmp/onplayercommand stuff lol. I don't like the idea of having to format 2700 lines of code by myself to ZCMD or anything >_<
Reply
#5

pawn Код:
if((strcmp("/heal", cmdtext, true) == 0) || (strcmp("/hp", cmdtext, true) == 0))
//Use this under OnPlayerCommandText
use this then
Reply
#6

Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
pawn Код:
if((strcmp("/heal", cmdtext, true) == 0) || (strcmp("/hp", cmdtext, true) == 0))
//Use this under OnPlayerCommandText
use this then
Thank you!
Reply
#7

You're most certainly welcome!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)