SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 31/05/2020, 02:32 PM   #1
Filbert
Huge Clucker
 
Join Date: May 2016
Posts: 251
Reputation: 1
Default weapon-config and /kill problem

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?

Last edited by Filbert; 01/06/2020 at 08:27 AM.
Filbert is offline   Reply With Quote
Old 01/06/2020, 08:27 AM   #2
Filbert
Huge Clucker
 
Join Date: May 2016
Posts: 251
Reputation: 1
Default Re: weapon-config and /kill problem

Bump
Filbert is offline   Reply With Quote
Old 01/06/2020, 08:38 AM   #3
Adamoneoone
Huge Clucker
 
Join Date: Sep 2014
Posts: 489
Reputation: 37
Default Re: weapon-config and /kill problem

Did you try using DamagePlayer?
__________________
If you want to have your own custom script, or even want to have one of our already released scripts, join our SCRIPTING SERVICES DISCORD, or send me a private message!
Adamoneoone is offline   Reply With Quote
Old 01/06/2020, 08:47 AM   #4
Filbert
Huge Clucker
 
Join Date: May 2016
Posts: 251
Reputation: 1
Default Re: weapon-config and /kill problem

Quote:
Originally Posted by Adamoneoone View Post
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;
}

Last edited by Filbert; 01/06/2020 at 09:22 AM.
Filbert is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SetPlayerHealth problem with weapon-config CopKing123 Scripting Help 5 01/06/2020 10:42 AM
weapon-config problem nomadsocio Scripting Help 0 19/03/2020 07:26 PM
weapon-config problem AfiqIqbal Scripting Help 8 16/12/2019 06:47 AM
Need Help With Weapon-Config.inc travistaylor Scripting Help 0 13/08/2018 08:50 PM


All times are GMT. The time now is 12:55 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.