HEADSHOT
#1

hi guys i got errors when i tryed to make a headshot code :P fix it plz
PHP код:
public OnPlayerHeadshot(playeridissueridweaponid)
{
    
//headshot system
    
if gHelmet[playerid] = true/////////// Line 86
    
{
        return 
0;
    }
    if(
AntiSK[playerid] = 1); ////////////////line 91
    
{
         return 
0;
    }
    switch(
weaponid////////////////Line 96
    
{
         case 
34:
           {
            
SetPlayerArmour(playerid0.0);
              
SetPlayerHealth(playerid0.0);
            
CallLocalFunction("OnPlayerDeath""iii"playeridissueridweaponid);
            
GameTextForPlayer(playerid"~r~~HEADSHOT :D !"50003);
            
SendClientMessage(issueridCOLOR_GREEN"+1 Score & +$5000 extra!");
            
GivePlayerMoney(issuerid5000);
            
GivePlayerScore(issuerid1);
            
PlayerPlaySound(playerid10520.00.00.0);
            
PlayerPlaySound(issuerid10520.00.00.0);
            return 
1;
        }
    }
    return 
1;

errors
PHP код:
C:\Users\SA-MP\Desktop\COD-RWW\pawno\include\GPABP.inc(1) : error 010invalid function or declaration
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6183) : error 025: function heading differs from prototype
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6186) : warning 211possibly unintended assignment
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6186) : error 001expected token"*then"but found ";"
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6186) : error 036: empty statement
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6191) : warning 225unreachable code
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6191) : warning 211possibly unintended assignment
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6191) : error 036: empty statement
C
:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6196) : warning 225unreachable code 
PHP код:
new bool:gHelmet[MAX_PLAYERS]; 
Reply
#2

if gHelmet[playerid] == true; and if(AntiSK[playerid] == 1);
Reply
#3

now again some errors
PHP код:
public OnPlayerHeadshot(playeridissueridweaponid)
{
    
//headshot system
    
if gHelmet[playerid] == true;
    {
        return 
0;
    }
    if(
AntiSK[playerid] == 1);
    {
         return 
0;
    }
    switch(
weaponid)
    {
         case 
34:
           {
            
SetPlayerArmour(playerid0.0);
              
SetPlayerHealth(playerid0.0);
            
CallLocalFunction("OnPlayerDeath""iii"playeridissueridweaponid);
            
GameTextForPlayer(playerid"~r~~HEADSHOT :D !"50003);
            
SendClientMessage(issueridCOLOR_GREEN"+1 Score & +$5000 extra!");
            
GivePlayerMoney(issuerid5000);
            
GivePlayerScore(issuerid1);
            
PlayerPlaySound(playerid10520.00.00.0);
            
PlayerPlaySound(issuerid10520.00.00.0);
            return 
1;
        }
    }
    return 
1;

Quote:

C:\Users\SA-MP\Desktop\COD-RWW\pawno\include\GPABP.inc(1) : error 010: invalid function or declaration
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6183) : error 025: function heading differs from prototype
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6186) : error 001: expected token: "*then", but found ";"
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6186) : error 036: empty statement
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6191) : warning 225: unreachable code
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6191) : error 036: empty statement
C:\Users\SA-MP\Desktop\COD-RWW\gamemodes\codee.pwn(6196) : warning 225: unreachable code
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

PHP код:
new bool:gHelmet[MAX_PLAYERS]; 
Reply
#4

if (gHelmet[playerid] == true) and if(AntiSK[playerid] == 1)

Sorry i didnt notice these.

Some of those lines are not in your code. Give all those lines.
Reply
#5

here is full code
Quote:

new bool:gHelmet[MAX_PLAYERS]; /////////for giveing player helmet

Quote:

new AntiSK[MAX_PLAYERS];////spawn protection for player

Quote:

public OnPlayerSpawn(playerid)
AntiSK[playerid] = 1;///// if player in anti spawn protection
gHelmet[playerid] = false;///////this is in onplayer

Quote:

public OnPlayerHeadshot(playerid, issuerid, weaponid)
{
//headshot system
if gHelmet[playerid] = true;
{
return 0;
}

if(AntiSK[playerid] = 1);
{
return 0;
}

switch(weaponid)
{
case 34:
{
SetPlayerArmour(playerid, 0.0);
SetPlayerHealth(playerid, 0.0);

CallLocalFunction("OnPlayerDeath", "iii", playerid, issuerid, weaponid);

GameTextForPlayer(playerid, "~r~~HEADSHOT !", 5000, 3);

SendClientMessage(issuerid, COLOR_GREEN, "+1 Score & +$5000 extra!");
GivePlayerMoney(issuerid, 5000);
GivePlayerScore(issuerid, 1);

PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerPlaySound(issuerid, 1052, 0.0, 0.0, 0.0);
return 1;
}
}
return 1;
}

Quote:

case 7:
{
if(GetPlayerMoney(playerid) < 5500) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: You don't have enough cash.") && ShowDialog(playerid);
ShowDialog(playerid);
GivePlayerMoney(playerid, -5500);
gHelmet[playerid] = true;
SendClientMessage(playerid, 0xF8D873FF, "You bought Helmet For Head Shot Protection");
}///this is when player buy helmet from shop.

or plz make a new code for headshot..not necessary onplayerheadshot .. make it in onplayertakedamage
Reply
#6

Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(GetPlayerTeam(issuerid) != GetPlayerTeam(playerid))
{
new w = GetPlayerWeapon(issuerid);
if(w == 34 || w == 33 || w == 24)
{
if(bodypart == 9)
{
if(gHelmet[playerid] == false)
{
SetPlayerHealth(playerid,0.0);
OnPlayerDeath(playerid, issuerid, w);
GameTextForPlayer(playerid,"~r~YOU GOT HEADSHOT",5000,3);
GameTextForPlayer(issuerid,"~r~PERFORMED HEADSHOT",5000,3);
}
else
{
GameTextForPlayer(issuerid,"~g~Player have helmet",5000,3);
}
}
}
}

or see this will work??
Reply
#7

here we go:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
 if(
issuerid != INVALID_PLAYER_ID && gHelmet[playerid] == true) return GameTextForPlayer(issuerid,"~g~Player have helmet",5000,3);
 if(
issuerid != INVALID_PLAYER_ID && AntiSK[playerid] == 1) return 0;
 if(
weaponid == 34 || weaponid == 33 || weaponid == 24 && issuerid != INVALID_PLAYER_ID && bodypart == 9)
   {
   
SetPlayerHealth(playerid,0.0);
   
OnPlayerDeath(playeridissueridw);
   
GameTextForPlayer(playerid,"~r~YOU GOT HEADSHOT",5000,3);
   
GameTextForPlayer(issuerid,"~r~PERFORMED HEADSHOT",5000,3);
   
SendClientMessage(issueridCOLOR_GREEN"+1 Score & +$5000 extra!");
   
GivePlayerMoney(issuerid5000);
   
GivePlayerScore(issuerid1);
   
PlayerPlaySound(playerid10520.00.00.0);
   
PlayerPlaySound(issuerid10520.00.00.0);
 }
 return 
1;

Reply
#8

how to do.. i mean player can shot with any weapon . i mean 22,23,24,25,26 any weapon id ..possible?
+1 rep for u
EDIT: I CANT GIVE U +1 TWICE
Reply
#9

here you can add more weapons:
PHP код:
 if(weaponid == 34 || weaponid == 33 || weaponid == 24 && issuerid != INVALID_PLAYER_ID && bodypart == 9
like we will add weapon id 22:
PHP код:
 if(weaponid == 22 || weaponid == 34 || weaponid == 33 || weaponid == 24 && issuerid != INVALID_PLAYER_ID && bodypart == 9
for multi weapons:
PHP код:
if(weaponid >= 22 && weaponid <= 26 && issuerid != INVALID_PLAYER_ID && bodypart == 9
now weapon id 22 to 26 [ 22-23-24-25-26 ] have headshot permission
Reply
#10

u didnt understand ..
anyway thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)