SA-MP Forums Archive
Anti TK doesn't work!!! - 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: Anti TK doesn't work!!! (/showthread.php?tid=480343)



Anti TK doesn't work!!! - Djane - 10.12.2013

Errors:
D:\SAMP Server\gamemodes\MW.pwn(3367) : error 025: function heading differs from prototype
D:\SAMP Server\gamemodes\MW.pwn(3370) : warning 217: loose indentation
D:\SAMP Server\gamemodes\MW.pwn(3371) : error 017: undefined symbol "Team_1"
D:\SAMP Server\gamemodes\MW.pwn(3371) : warning 215: expression has no effect
D:\SAMP Server\gamemodes\MW.pwn(3371) : error 001: expected token: ";", but found "]"
D:\SAMP Server\gamemodes\MW.pwn(3371) : error 029: invalid expression, assumed zero
D:\SAMP Server\gamemodes\MW.pwn(3371) : fatal error 107: too many error messages on one line

Код:
public OnPlayerTakeDamage(playerid, damagedid, Float: amount, weaponid)
{
        new Float:HP;
	GetPlayerHealth(damagedid, HP);
 	if(Team_1[playerid] == 1 && Team_1[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_2[playerid] == 1 && Team_2[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_3[playerid] == 1 && Team_3[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_4[playerid] == 1 && Team_4[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_5[playerid] == 1 && Team_5[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_6[playerid] == 1 && Team_6[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_7[playerid] == 1 && Team_7[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_8[playerid] == 1 && Team_8[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_9[playerid] == 1 && Team_9[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        if(Team_10[playerid] == 1 && Team_10[damagedid] == 1)
	{
		SetPlayerHealth(damagedid, HP-0);
	}
        return 1;
}
Errors:
D:\SAMP Server\gamemodes\MW.pwn(3373) : error 021: symbol already defined: "OnPlayerSpawn"

Код:
new pAlreadySpawned[MAX_PLAYERS],
    pTeam[MAX_PLAYERS];

//Your code to let the player choose his/her team. In this code you'll set the pTeam variable

public OnPlayerSpawn(playerid)
{
    if(pAlreadySpawned[playerid] != 1)
    {
        pAlreadySpawned[playerid] = 1;
        SetPlayerTeam(playerid, pTeam[playerid]);
    }
    return 1;
}
Errors:
D:\SAMP Server\gamemodes\MW.pwn(3373) : warning 209: function "OnPlayerTakeDamage" should return a value

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerTeam(playerid) == GetPlayerTeam(issuerid))
    {
        GameTextForPlayer(issuerid, "~r~Dont atack your team!", 2000, 6); return 0;    
    }
}
I said I am a newbie can you past me the right code!?
Don't know where to put this i putted on the end of the script all codes.Is that right I don't know how to do this so please PASTE ME THE CODEEE!!!AND WHERE TO PUT!?


Re: Anti TK doesn't work!!! - Biesmen - 10.12.2013

First of all: DON'T make a new thread if you've already got a question like this! Post it here: https://sampforum.blast.hk/showthread.php?tid=480276

Second of all: You're COPYING and PASTING scripts without understanding them, or even reading what the poster of that piece of script has told you.


Re: Anti TK doesn't work!!! - Astralis - 10.12.2013

You didn't gave us lines so we can't exactly know which line is which, should of given like:

pawn Код:
new playerid; // error line 3373
Anyways, on top of the script do:

pawn Код:
new Team_1[MAX_PLAYERS];
Since it aint defined, and if it will say the same error for Team_2 and others just do like with Team_1.

Loose indentation warning means that your code is not aligned.

Change

pawn Код:
public OnPlayerTakeDamage(playerid, damagedid, Float: amount, weaponid)
to

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
When player chooses a team, you should also always do

pawn Код:
Team_1[playerid]=1;
and all the other teams like Team_2 and so on.

I guess you should try to understand something here instead of copy pasting and trying to make it work since it won't help you to learn anything.