How do I make a /kill command with a message?
|
|
CommanderDEATH | Date: Monday, 2014-09-08, 12:57 PM | Message # 1 |
Private
Group: Users
Messages: 2
Status: Offline
| I want to make a new command called "/kill". I think you all know what it does. This is what suppose to happen: After the player types the command into the text box (after pressing t) then a message also comes up, saying "WOW! PLAYERNAME has just committed suicide!".
This is what I have so far: public OnPlayerCommandText (playerid, cmdtext[]) { if (strcmp("/kill", cmdtext, true, 5)== 0) { format(string, sizeof(string), "WOW! %s has just committed suicide!", name); SendClientMessageToAll(0xFF0000FF, string); SetPlayerHealth(playerid, 0.0); return 1; } return 0; } This is the error message that comes up when I compile/run: C:\Documents and Settings\NAME\Desktop\My SA-MP Server\gamemodes\baserp.pwn(554) : error 017: undefined symbol "string" C:\Documents and Settings\NAME\Desktop\My SA-MP Server\gamemodes\baserp.pwn(554) : error 017: undefined symbol "string" C:\Documents and Settings\NAME\Desktop\My SA-MP Server\gamemodes\baserp.pwn(554) : error 029: invalid expression, assumed zero C:\Documents and Settings\NAME\Desktop\My SA-MP Server\gamemodes\baserp.pwn(554) : fatal error 107: too many error messages on one line
Please help! :(
Message edited by CommanderDEATH - Wednesday, 2014-09-10, 11:07 AM |
|
| |
DERSCRIPTER | Date: Monday, 2014-11-17, 9:00 PM | Message # 2 |
Private
Group: Users
Messages: 2
Status: Offline
| do it this way:
public OnPlayerCommandText (playerid, cmdtext[]) { new string[128]; if (strcmp("/kill", cmdtext, true, 5)== 0) { format(string, sizeof(string), "WOW! %s has just committed suicide!", name); SendClientMessageToAll(0xFF0000FF, string); SetPlayerHealth(playerid, 0); return 1; } return 1; }
PS: you can define colors like this: #define [your color] 0xFF0000FF
|
|
| |
shanidputhiyapurayil | Date: Thursday, 2016-10-20, 9:40 PM | Message # 3 |
Private
Group: Users
Messages: 4
Status: Offline
| you could avoid using strings.just use sendclientmessage.
|
|
| |
newtondalton007 | Date: Thursday, 2017-01-12, 5:03 PM | Message # 4 |
Private
Group: Users
Messages: 4
Status: Offline
| Quote DERSCRIPTER ( ) public OnPlayerCommandText (playerid, cmdtext[]){ new string[128]; if (strcmp("/kill", cmdtext, true, 5)== 0) { format(string, sizeof(string), "WOW! %s has just committed suicide!", name); SendClientMessageToAll(0xFF0000FF, string); SetPlayerHealth(playerid, 0); return 1; } return 1; } Correct!
|
|
| |
paharinil | Date: Sunday, 2017-03-05, 7:48 PM | Message # 5 |
Private
Group: Users
Messages: 4
Status: Offline
| oh good
|
|
| |
moklessdesign | Date: Wednesday, 2017-12-20, 3:32 PM | Message # 6 |
Private
Group: Users
Messages: 4
Status: Offline
| Great.
Make Fort Carson Great Again www.fc-roleplay.com | server.fc-roleplay.com:7777
|
|
| |
raajparker | Date: Monday, 2018-01-08, 4:13 AM | Message # 7 |
Private
Group: Users
Messages: 4
Status: Offline
| Wow , finallyi got to know creating kill command! thanks!
|
|
| |
rumenkostoff | Date: Friday, 2023-08-18, 5:03 AM | Message # 8 |
Private
Group: Users
Messages: 5
Status: Offline
| i would advise you to use some of the new command processors instead, they are way faster and more efficient. I think one of them was called ZCMD v2
|
|
| |