[Help]SetPlayerHealth
#1

Hello Guys
how i can made
PHP код:
SetPlayerHealth(targetid0); 
in Checkpoints ? i want make it For Targetid To die when he is in Checkpoints!!
any idea to make it
(i Made Kidnap Script )
PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
if (
Player_NextKidnapp{playerid})
{
    
Player_NextKidnapp{playerid} = false;
    
DisablePlayerRaceCheckpoint(playerid);
    
//SetPlayerHealth(targetid, 0);
    
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid)+6);
    
GivePlayerMoney(playerid25000+random(113452));
    return 
1;
}
return 
1;

how i can make him dead ? the targetid!! i kidnaped him !!
Reply
#2

just uncomment the SetPlayerHealth in that callback lol.
Reply
#3

Код:
public OnPlayerEnterRaceCheckpoint(playerid) 
{ 
if (Player_NextKidnapp{playerid}) 
{ 
    Player_NextKidnapp{playerid} = false; 

    DisablePlayerRaceCheckpoint(playerid); 
    SetPlayerHealth(targetid, 0); 
    SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+6); 
    GivePlayerMoney(playerid, 25000+random(113452)); 
    return 1; 
} 
return 1; 
}
Just uncommented SetPlayerHealth. it was simple mate.
Reply
#4

Quote:
Originally Posted by Smileys
Посмотреть сообщение
just uncomment the SetPlayerHealth in that callback lol.
There tutorial To know how to made it!!
Reply
#5

Hello!

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if (
Player_NextKidnapp{playerid})
    {
        
Player_NextKidnapp{playerid} = false;
        
DisablePlayerRaceCheckpoint(playerid);
        
SetPlayerHealth(playerid0);
        
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid)+6);
        
GivePlayerMoney(playerid25000+random(113452));
        return 
1;
    }
    return 
1;

So, but you haven't targetid definied in OnPlayerEnterRaceCheckpoint.
Reply
#6

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new playerKidnapped[MAX_PLAYERS];

public OnPlayerConnect(playerid){
    playerKidnapped[playerid] = -1;
    return 1;
}

CMD:kidnap(playerid, params[]){
   
    new id;
    if(sscanf(params, "u", id))return SendClientMessage(playerid, -1, "USAGE: /kidnap [playerid/name]");
    {
        if(!IsPlayerConnected(id))return 1;
       
        if(playerKidnapped[playerid] != -1)return 1;
        if(playerKidnapped[id] != -1)return 1;
       
        playerKidnapped[playerid] = id;
        playerKidnapped[id] = playerid;
    }
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    if (Player_NextKidnapp{playerid})
    {
        Player_NextKidnapp{playerid} = false;
        DisablePlayerRaceCheckpoint(playerid);
        SetPlayerHealth(playerKidnapped[playerid], 0);
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+6);
        GivePlayerMoney(playerid, 25000+random(113452));
        return 1;
    }
    return 1;
}
Basic start off for you, work from there. No checkpoints are set from this script, but I'm sure you can work that out.
Reply
#7

Quote:
Originally Posted by iGetty
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>

new playerKidnapped[MAX_PLAYERS];

public OnPlayerConnect(playerid){
    playerKidnapped[playerid] = -1;
    return 1;
}

CMD:kidnap(playerid, params[]){
   
    new id;
    if(sscanf(params, "u", id))return SendClientMessage(playerid, -1, "USAGE: /kidnap [playerid/name]");
    {
        if(!IsPlayerConnected(id))return 1;
       
        if(playerKidnapped[playerid] != -1)return 1;
        if(playerKidnapped[id] != -1)return 1;
       
        playerKidnapped[playerid] = id;
        playerKidnapped[id] = playerid;
    }
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    if (Player_NextKidnapp{playerid})
    {
        Player_NextKidnapp{playerid} = false;
        DisablePlayerRaceCheckpoint(playerid);
        SetPlayerHealth(playerKidnapped[playerid], 0);
        SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+6);
        GivePlayerMoney(playerid, 25000+random(113452));
        return 1;
    }
    return 1;
}
Basic start off for you, work from there. No checkpoints are set from this script, but I'm sure you can work that out.
there error when i adding the set health
see here
PHP код:
public OnPlayerConnect(playerid)
{
    
Player_NextKidnapp{playerid} = false;
    return 
1;
}
CMD:kidnap(playeridparams[])
{
    new 
targetid;
    if(
sscanf(params,"d",targetid)) return SendClientMessage(playerid0xFF0000FF"USAGE: /kidnap [id]");
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid0xFF0000FF"ERROR: You must be on vehicle!");
    if(
noexit[targetid] == 1noexit[targetid] = 0;
    
noexit[targetid] = 1;
    
PutPlayerInVehicle(targetidGetPlayerVehicleID(playerid), 1);
    new 
rand random(sizeof (NextKidnapp));
    
SetPlayerRaceCheckpoint(playerid2NextKidnapp[rand][0], NextKidnapp[rand][1], NextKidnapp[rand][2], 0.00.00.05.0);
    
SendClientMessage(targetidCOLOR_RED"You Can Out /cutrope");
    new 
String[128];
    
format(Stringsizeof(String), "You kidnapped %s"pName(targetid));
    
GameTextForPlayer(playeridString50004);
    
//for Victim:
    
format(Stringsizeof(String), "You kidnaped From %s"pName(playerid));
    
GameTextForPlayer(targetidString50004);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: