My site
How do I make a /kill command with a message? - SAMP/PAWNO FORUM
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
SAMP/PAWNO FORUM » Pawno » Scripting Help » How do I make a /kill command with a message? (Pawno SA-MP. Roleplay Server. Commands. /kill. Messages.)
How do I make a /kill command with a message?
CommanderDEATHDate: Monday, 2014-09-08, 12:57 PM | Message # 1
Private
Group: Users
Messages: 2
Reputation: 0
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
 
DERSCRIPTERDate: Monday, 2014-11-17, 9:00 PM | Message # 2
Private
Group: Users
Messages: 2
Reputation: 0
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
 
shanidputhiyapurayilDate: Thursday, 2016-10-20, 9:40 PM | Message # 3
Private
Group: Users
Messages: 4
Reputation: 0
Status: Offline
you could avoid using strings.just use sendclientmessage.
 
newtondalton007Date: Thursday, 2017-01-12, 5:03 PM | Message # 4
Private
Group: Users
Messages: 4
Reputation: 0
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!
 
paharinilDate: Sunday, 2017-03-05, 7:48 PM | Message # 5
Private
Group: Users
Messages: 4
Reputation: 0
Status: Offline
oh good
 
moklessdesignDate: Wednesday, 2017-12-20, 3:32 PM | Message # 6
Private
Group: Users
Messages: 4
Reputation: 0
Status: Offline
Great.


Make Fort Carson Great Again
www.fc-roleplay.com | server.fc-roleplay.com:7777
 
raajparkerDate: Monday, 2018-01-08, 4:13 AM | Message # 7
Private
Group: Users
Messages: 4
Reputation: 0
Status: Offline
Wow , finallyi got to know creating kill command! smile thanks!
 
rumenkostoffDate: Friday, 2023-08-18, 5:03 AM | Message # 8
Private
Group: Users
Messages: 5
Reputation: 0
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
 
SAMP/PAWNO FORUM » Pawno » Scripting Help » How do I make a /kill command with a message? (Pawno SA-MP. Roleplay Server. Commands. /kill. Messages.)
  • Page 1 of 1
  • 1
Search:


free hit counter
Thank You For Visiting