SA-MP Forums Archive
Need help in my headshot system project - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help in my headshot system project (/showthread.php?tid=650139)



Need help in my headshot system project - LegendAbdullah - 21.02.2018

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:
Quote:

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 © 1997-2006, ITB CompuPhase


4 Errors.

Link to the script:
Quote:
http://www.mediafire.com/file/5533ol...9/Headshot.pwn
Code:
Quote:

#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;
}




Re: Need help in my headshot system project - LegendAbdullah - 21.02.2018

@anyone someone plz answer me and help me


Re: Need help in my headshot system project - ISmokezU - 21.02.2018

Indentation.

You missed defining message

PHP код:
new message[80]; 
PHP код:
#include < a_samp >
#define FILTERSCRIPT
public OnFilterScriptInit() {
return 
1;
}
public 
OnFilterScriptExit() {
return 
1;
}
public 
OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart
{
   if (
issuerid != INVALID_PLAYER_ID) {
   if (
weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
   if (
bodypart == 9
   {
       
SetPlayerHealth(playerid0.0);
       
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
       
PlayerPlaySound(issuerid178020.00.00.0);
       
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
       
PlayerPlaySound(playerid178020.00.00.0);
       new 
message[80];
       
format(messagesizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}"playerNameotherID);
       
SendClientMessageToAll(COLOR_ORANGEmessage);
       }
     }
  }
  return 
1;




Re: Need help in my headshot system project - AstroPoid - 21.02.2018

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


Re: Need help in my headshot system project - LegendAbdullah - 22.02.2018

Thank for Help guy!
Credits
#Abdullah420
#ISmokerZu
#AstroPiod


Re: Need help in my headshot system project - LegendAbdullah - 22.02.2018

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Indentation.

You missed defining message

PHP код:
new message[80]; 
PHP код:
#include < a_samp >
#define FILTERSCRIPT
public OnFilterScriptInit() {
return 
1;
}
public 
OnFilterScriptExit() {
return 
1;
}
public 
OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart
{
   if (
issuerid != INVALID_PLAYER_ID) {
   if (
weaponid == 33 || weaponid == 34 || weaponid == 33 || weaponid == 34) {
   if (
bodypart == 9
   {
       
SetPlayerHealth(playerid0.0);
       
GameTextForPlayer(issuerid,"~r~Headshot",2000,3);
       
PlayerPlaySound(issuerid178020.00.00.0);
       
GameTextForPlayer(playerid,"~r~Headshot",2000,3);
       
PlayerPlaySound(playerid178020.00.00.0);
       new 
message[80];
       
format(messagesizeof(message), "{FF7700}%s has been killed in a Headshot by %s {FF7700}"playerNameotherID);
       
SendClientMessageToAll(COLOR_ORANGEmessage);
       }
     }
  }
  return 
1;

Quote:
Originally Posted by AstroPoid
Посмотреть сообщение
Use the code new Message[128]; over the format of Message
Still Error:-
Quote:

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 © 1997-2006, ITB CompuPhase


2 Errors.

Please Fix it


Re: Need help in my headshot system project - ivndosos - 22.02.2018

Код:
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


Re: Need help in my headshot system project - LegendAbdullah - 22.02.2018

Quote:
Originally Posted by ivndosos
Посмотреть сообщение
Код:
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
PHP код:
C:\Users\hp\Desktop\Headshot.pwn(32) : error 017undefined symbol "playerName"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

??


Re: Need help in my headshot system project - Dayrion - 22.02.2018

Quote:
Originally Posted by LegendAbdullah
Посмотреть сообщение
PHP код:
C:\Users\hp\Desktop\Headshot.pwn(32) : error 017undefined symbol "playerName"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB 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.


Re: Need help in my headshot system project - LegendAbdullah - 22.02.2018

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
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..