weapon-config and /kill problem -
Filbert - 31.05.2020
i'm using weapon-config.inc by Slice and couldnt use the /kill and /class commands. They were unknown command..
Here's the code :
pawn Code:
CMD:class(playerid, params[])
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid,COLOR_GREEN,"[CLASS]You have been force to the class section");
ForceClassSelection(playerid);
return 1;
}
CMD:kill(playerid,params[]) {
new string[128];
if(IsSpawned[playerid] == 1)
{
if(PlayerInfo[playerid][God] == 1) return SendClientMessage(playerid, red, "ERROR: You are in the god mode. /god to deactivate it");
if(OnFly[playerid] == true) return SendClientMessage(playerid, red, "ERROR: You are in the fly mode. /fly to deactivate it");
if(cuffed[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are in Hand Cuffs and cannot kill yourself!");
if(IsPlayerInAnyVehicle(playerid)) {
if(VehicleInfo[GetPlayerVehicleID(playerid)][Temp] == 1) SetTimerEx("EraseVehicle", 10000,0,"i",GetPlayerVehicleID(playerid));
}
new Float:health;
if(GetPlayerHealth(playerid, health) >0) {
SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
SetPlayerHealth(playerid,0);
format(string, sizeof(string), "[DEATH]: %s Has Just Killed His Retarded Self /Kill", pName(playerid));
SendClientMessageToAll(COLOR_YELLOW, string);
return 1;
}
}
return 1;
}
EDIT: It's the OnPlayerDamage() errors maybe ? idk but here's the code, i cant find anything wrong with it
pawn Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weaponid, &bodypart)
{
if(PlayerInfo[playerid][team] == PlayerInfo[issuerid][team] && InDuel[playerid] == 0 && InDuel[issuerid] == 0 && InDM[playerid] == 0 && InDM[issuerid] == 0)
{
GameTextForPlayer(issuerid, "~<~ ~r~Team killing is not allowed ~>~", 1000, 5);
return 0;
}
if(event_type == TDM && p_team[issuerid] == p_team[playerid] && InDuel[playerid] == 0 && InDuel[issuerid] == 0 && InDM[playerid] == 0 && InDM[issuerid] == 0)
{
GameTextForPlayer(issuerid, "~<~ ~r~Team killing is not allowed ~>~", 1000, 5);
return 0;
}
if(PlayerInfo[issuerid][HitSound] == 1) SetDamageSounds(0, 17802);
if(PlayerInfo[playerid][God] == 1) return 0;
if(OnFly[playerid] == true) return 0;
return 1;
}
Every action that uses SetPlayerHealth is bugged. How to fix this?
Re: weapon-config and /kill problem -
Filbert - 01.06.2020
Bump
Re: weapon-config and /kill problem -
Adamoneoone - 01.06.2020
Did you try using DamagePlayer?
Re: weapon-config and /kill problem -
Filbert - 01.06.2020
Quote:
Originally Posted by Adamoneoone
Did you try using DamagePlayer?
|
No i didnt, should i really use it and cant use setplayerhealth?
EDIT: So, i've tried it without adding anything in the OnPlayerDamage(), and the SetPlayerHealth is working, so there should be something wrong with my code.. but idk what it is
pawn Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weaponid, &bodypart)
{
if(PlayerInfo[playerid][God] == 1 || OnFly[playerid] == true) return 0;
if(PlayerInfo[issuerid][HitSound] == 1) SetDamageSounds(0, 17802);
if(PlayerInfo[playerid][team] == PlayerInfo[issuerid][team] && InDuel[playerid] == 0 && InDuel[issuerid] == 0 && InDM[playerid] == 0 && InDM[issuerid] == 0 && !IsPlayerInEvent(playerid) && !IsPlayerInEvent(issuerid))
{
GameTextForPlayer(issuerid, "~<~ ~r~Team killing is not allowed ~>~", 1000, 5);
return 0;
}
if(event_type == TDM && p_team[issuerid] == p_team[playerid] && InDuel[playerid] == 0 && InDuel[issuerid] == 0 && InDM[playerid] == 0 && InDM[issuerid] == 0)
{
GameTextForPlayer(issuerid, "~<~ ~r~Team killing is not allowed ~>~", 1000, 5);
return 0;
}
return 1;
}