PDA

View Full Version : Need help in my headshot system project


LegendAbdullah
21/02/2018, 03:39 PM
Hello Guys!
Im New in SA-MP Community and i just learnt scripting, so i decided to make my own headshot Filterscript,
But there are some bugs in it
Who ever will fix this bug will be in credits of this Filterscript!


Error:
C:\Users\Abdullah420\Desktop\Headshot.pwn(30) : error 017: undefined symbol "message"
C:\Users\Abdullah420\Desktop\Headshot.pwn(30) : error 017: undefined symbol "message"
C:\Users\Abdullah420\Desktop\Headshot.pwn(30) : error 029: invalid expression, assumed zero
C:\Users\Abdullah420\Desktop\Headshot.pwn(30) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Link to the script:
http://www.mediafire.com/file/5533ole13cvwv89/Headshot.pwn

Code:

#include <a_samp>

#define FILTERSCRIPT

public OnFilterScriptInit()
{
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID)
{
if(IsPlayerConnected(issuerid))
{
if(weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34)
{
if(bodypart == 9)
{
SetPlayerHealth(playerid, 0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
}
return 1;
}

LegendAbdullah
21/02/2018, 03:44 PM
@anyone someone plz answer me and help me

ISmokezU
21/02/2018, 03:47 PM
Indentation.

You missed defining message

new message[80];

#include < a_samp >

#define FILTERSCRIPT

public OnFilterScriptInit() {
return 1;
}

public OnFilterScriptExit() {
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}

AstroPoid
21/02/2018, 03:48 PM
Use the code new Message[128]; over the format of Message

LegendAbdullah
22/02/2018, 05:54 AM
Thank for Help guy!
Credits
#Abdullah420
#ISmokerZu
#AstroPiod

LegendAbdullah
22/02/2018, 06:06 AM
Indentation.

You missed defining message

new message[80];

#include < a_samp >

#define FILTERSCRIPT

public OnFilterScriptInit() {
return 1;
}

public OnFilterScriptExit() {
return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}

Use the code new Message[128]; over the format of Message

Still Error:-
C:\Users\hp\Desktop\Headshot.pwn(31) : error 017: undefined symbol "playerName"
C:\Users\hp\Desktop\Headshot.pwn(32) : error 017: undefined symbol "COLOR_ORANGE"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.


Please Fix it :(

ivndosos
22/02/2018, 06:10 AM
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName);
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}


and add this at the top

#define COLOR_ORANGE 0xFF4500AA

LegendAbdullah
22/02/2018, 06:12 AM
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName);
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}


and add this at the top

#define COLOR_ORANGE 0xFF4500AA

C:\Users\hp\Desktop\Headshot.pwn(32) : error 017: undefined symbol "playerName"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

??

ivndosos
22/02/2018, 06:17 AM
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}


my bad forgot a bracket

Dayrion
22/02/2018, 06:17 AM
C:\Users\hp\Desktop\Headshot.pwn(32) : error 017: undefined symbol "playerName"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

??

Did you ever script something or you are just copy/paste codes you find on the web? You don't even try to understand what this error means. You are just asking for solving them, which make no sense.

LegendAbdullah
22/02/2018, 06:19 AM
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if (issuerid != INVALID_PLAYER_ID) {
if (weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
if (bodypart == 9)
{
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, sizeof(playerName));
SetPlayerHealth(playerid, 0.0);
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
PlayerPlaySound(issuerid, 17802, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0);
new message[80];
format(message, sizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}", playerName, otherID);
SendClientMessageToAll(COLOR_ORANGE, message);
}
}
}
return 1;
}


my bad forgot a bracket
Where i need to add bracket ?? i cant understand you dude..

LegendAbdullah
22/02/2018, 06:23 AM
Did you ever script something or you are just copy/paste codes you find on the web? You don't even try to understand what this error means. You are just asking for solving them, which make no sense.
1. Im New in SA-MP
2. Its first time that im making a script(I dont have experience in scripting)
3. i just need help to complete this project, Whatever If you get ban and i get SPAM MACHINE Role in your inactivity?
So have you listen that story "The Rabbit and The Tortoise", If you dont listened then read it and you will see what happend with Rabbit and whats gonna happen with you..

ivndosos
22/02/2018, 06:23 AM
Where i need to add bracket ?? i cant understand you dude..
I added it for you


GetPlayerName(playerid, playerName, sizeof(playerName));

just use the last code i gave u

LegendAbdullah
22/02/2018, 06:35 AM
I added it for you


GetPlayerName(playerid, playerName, sizeof(playerName));

just use the last code i gave u

C:\Users\hp\Desktop\Headshot.pwn(34) : error 017: undefined symbol "otherID"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

Coraxx
22/02/2018, 06:39 AM
Such a easy error. Dude, first learn some basics. These kind of errors are too easy to fix.

LegendAbdullah
22/02/2018, 06:40 AM
Such a easy error. Dude, first learn some basics. These kind of errors are too easy to fix.

then fix it ..

LegendAbdullah
22/02/2018, 06:49 AM
haha see you cant fix it, NEWBIE...

ivndosos
22/02/2018, 06:56 AM
http://wiki.sa-mp.com/wiki/Category:Scripting_Functions

http://forum.sa-mp.com/forumdisplay.php?f=70

Sew_Sumi
22/02/2018, 06:59 AM
Now this guys, is why you don't copy paste code out in answers to people who simply demand it.

Dayrion
22/02/2018, 07:13 AM
1. Im New in SA-MP
2. Its first time that im making a script(I dont have experience in scripting)
3. i just need help to complete this project, Whatever If you get ban and i get SPAM MACHINE Role in your inactivity?
So have you listen that story "The Rabbit and The Tortoise", If you dont listened then read it and you will see what happend with Rabbit and whats gonna happen with you..

There is a difference between being new and learning from your mistakes to progress and being new without learning anything and asking others to correct your own script.
And why are talking about I can/will get banned? Plus, what's gonna happens to me? What the hell are those menaces? :confused:

LegendAbdullah
22/02/2018, 07:15 AM
Okay i will learn by the way can you tell me how can i use GetOtherName ..?
I know GetPlayerName function but what function to get other player name/id??

Dayrion
22/02/2018, 08:29 AM
Okay i will learn by the way can you tell me how can i use GetOtherName ..?
I know GetPlayerName function but what function to get other player name/id??

Your error message means "otherID" is nonexistent. You did not create the variable. Either you create the variable or you delete it.

RogueDrifter
22/02/2018, 10:40 AM
there's no GetOtherName jesus and you should respect people trying to help you as they're not forced to do so,

You really need to learn the basics of this, GetPlayerName(playerid, string, sizeof(string));

This can be used to get anyone's name, playerid is a variable you can change it to get that 'other' name of the 'other' player id, string is where you save that player's name and the 3rd parameter is the length of that string.

Mugala
22/02/2018, 11:41 AM
undefined symbol "message"
it means that symbol like this "message" doesn't exists in your code, so you have to create it by yourself, using new name or new name[size]