public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9)
{
new string[128], dead[24], killer[24];
GameTextForPlayer(issuerid, "~r~Headshot!",3000,4);
GetPlayerName(playerid, dead, sizeof(dead));
GetPlayerName(issuerid, killer, sizeof(killer));
format(string, sizeof(string), "{FFFF00}%s (%i) {FF0000}Popped {FFFF00}%s (%i) {FF0000}head with a Sniper Rifle", killer, issuerid, dead, playerid);
SendClientMessageToAll(COLOR_WHITE, string);
SetPlayerHealth(playerid, 0.0);
}
return 1;
}
if(issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9 && gTeam[playerid] != gTeam[issuerid])
{
new string[128], dead[24], killer[24];
GameTextForPlayer(issuerid, "~r~Headshot!",3000,4);
GetPlayerName(playerid, dead, sizeof(dead));
GetPlayerName(issuerid, killer, sizeof(killer));
format(string, sizeof(string), "{FFFF00}%s (%i) {FF0000}Popped {FFFF00}%s (%i) {FF0000}head with a Sniper Rifle", killer, issuerid, dead, playerid);
SendClientMessageToAll(COLOR_WHITE, string);
SetPlayerHealth(playerid, 0.0);
}
|
Check if the players are in the same team...
From what I remember you had gTeam[MAX_PLAYERS] array... So the code is: PHP код:
|
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & 131072)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, -1750.30103, 985.93646, 20.30861))
{
if(IsObjectMoving(pddoor1)) return GameTextForPlayer(playerid, "~w~please wait", 1000, 3);
{
if(gTeam[playerid] != GROVE) return SendClientMessage(playerid, COLOR_RED, "You can't access this gate");
{
MoveObject(pddoor1, -1750.30103, 985.93646, 4.38891, 3.0);
SetTimerEx("doorclose1", 5000, false, "i", playerid);
SendClientMessage(playerid, COLOR_GREEN, "Gate Opening, It will close automatically after 5 seconds");
Update3DTextLabelText(pdlabel1, 0xFFFFFFFF, "{33CC33}=Grove=\n{FFFFFF}Gate Status: {33CC33}Opened\n{FFFFFF}Press {FF6600}N {FFFFFF}key");
}
}
}
}
return 1;
}
forward doorclose1(playerid);
public doorclose1(playerid)
{
MoveObject(pddoor1, -1750.30103, 985.93646, 20.30861, 3.0);
Update3DTextLabelText(pdlabel1, 0xFFFFFFFF, "{33CC33}=Grove=\n{FFFFFF}Gate Status: {FF0000}Closed\n{FFFFFF}Press {FF6600}N {FFFFFF}key");
return 1;
}
//a global boolean variable. (Boolean = Can only have true/ false valories)
new bool:door_grove;
//And now the code looks like (well, should look)
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys & 131072)
{
if(IsPlayerInRangeOfPoint(playerid, 4.0, -1750.30103, 985.93646, 20.30861))
{
if(IsObjectMoving(pddoor1)) return GameTextForPlayer(playerid, "~w~please wait", 1000, 3);
{
if(gTeam[playerid] != GROVE) return SendClientMessage(playerid, COLOR_RED, "You can't access this gate");
{
new status, labeltext[90];
if(!door_grove)
{
MoveObject(pddoor1, -1750.30103, 985.93646, 4.38891, 3.0);
SendClientMessage(playerid, COLOR_GREEN, "Gate Open! Use N to close it.");
Update3DTextLabelText(pdlabel1, 0xFFFFFFFF, "{33CC33}=Grove=\n{FFFFFF}Gate Status: {33CC33}Opened\n{FFFFFF}Press {FF6600}N {FFFFFF}key");
door_grove = true;
return 1;
}
MoveObject(pddoor1, -1750.30103, 985.93646, 20.30861, 3.0);
SendClientMessage(playerid, COLOR_GREEN, "Gate Closed! Use N to open it");
Update3DTextLabelText(pdlabel1, 0xFFFFFFFF, "{33CC33}=Grove=\n{FFFFFF}Gate Status: {FF0000}Closed\n{FFFFFF}Press {FF6600}N {FFFFFF}key");
door_grove = false;
return 1;
}
}
}
}
return 1;
}
|
Well, i think this can do the job:
PHP код:
|
bare.pwn(274) : warning 203: symbol is never used: "status"
|
You have a variable named status, which is not used... Search for status and remove it, ONLY if you think you don't need it.
|