12.11.2011, 07:04
Well, I saw many newbies need it,
How to create "Strcmp" command ?
Strcmp command always being show'd under the callback:
In this thread, We will try, The "/kill" command.
This is the whole Script:
Explain:
Line 1 - That our Callback
Line 2 - We open the callback
Line 3 - We ask ourselves, What happened if he type the command kill ?
Line 4 - We open the command
Line 5 - We are killing him as we set his health to 0
Line 6 - We are sending the player a message with colour Embeding "You have been died!"
Line 7 - If all that happened, Return that all what happened is TRUE
Line 8 - We are closing the command
Line 9 - If the player sending "Unknown command" it will say "Wrong Command"
Line 10 - We are closing the callback.
Regards,
InterRP Team
How to create "Strcmp" command ?
Strcmp command always being show'd under the callback:
pawn Код:
public OnPlayerCommand(playerid, cmdtext[])
This is the whole Script:
pawn Код:
/*Line 1*/public OnPlayerCommand(playerid, cmdtext[])
/*Line 2*/{
/*Line 3*/ if(strcmp("/kill", cmdtext, true) == 0)
/*Line 4*/ {
/*Line 5*/ SetPlayerHealth(playerid, 0.0);
/*Line 6*/ SendClientMessage(playerid, 0x00000000, "{FFFFFF}You have been {FF0000}died!");
/*Line 7*/ return 1;
/*Line 8*/ }
/*Line 9*/ return SendClientMessage(playerid, 0x00000000, "{FFFFFF}Wrong {FFFF00}Command");
/*Line 10*/}
Line 1 - That our Callback
Line 2 - We open the callback
Line 3 - We ask ourselves, What happened if he type the command kill ?
Line 4 - We open the command
Line 5 - We are killing him as we set his health to 0
Line 6 - We are sending the player a message with colour Embeding "You have been died!"
Line 7 - If all that happened, Return that all what happened is TRUE
Line 8 - We are closing the command
Line 9 - If the player sending "Unknown command" it will say "Wrong Command"
Line 10 - We are closing the callback.
Regards,
InterRP Team