Kidnap command
#1

I've creating a kidnap command IT'S WORKED but when I goto to the checkpoint The driver will be die why? I want the enemy player must be die how?

COMMAND
PHP код:
CMD:kidnap(playerid, params[])
{
    if(
PlayerInfo[playerid][pKidnaper] == 0)
    {
        
SendClientMessage(playerid, -1, "{FF0000}Error: {ffffff}This command only for Kidnappers Jobs.");
        return 
1;
    }
    new 
tName[MAX_PLAYER_NAME],targetid,pName[MAX_PLAYER_NAME],Value;
    new 
string[128];
    if(
IsPlayerSpawned[playerid]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You must be spawned to use that command.");
     if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,"{FF0000}Error: {FFFFFF}Player isn't connected!");
    if(
sscanf(params, "uds[50]", targetid, Value)) return SendClientMessage(playerid, -1, "{189381}USAGE: {FFFFFF}/kidnap [ID] [Value]");
    if(
CompleteKidnap[targetid] == 1) return SendClientMessage(playerid, -1,"{FF0000}Error: {FFFFFF}Player is already kidnapped!");
    
GetPlayerName(targetid, tName, sizeof(tName));
    
GetPlayerName(playerid, pName, sizeof(pName));
    if(
Value > 24999)
    {
        if(
IsPlayerInAnyVehicle(playerid))
        {
              if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER && GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
             {
                 if(
kdinaptime[playerid] == 0)
                {
                    
kidnapper1[playerid] = playerid;
                     
Value = Money[playerid];
                      
TogglePlayerControllable(targetid, 0);
                    
format(string,sizeof(string), "{E33667}[Kidnapping]: {FFFFFF}Player {E33667}%s(%d) {FFFFFF}has been {E33667}KIDNAPPING {FFFFFF}by {E33667}%s(%d){FFFFFF}.", tName,targetid, pName,playerid);
                     
SendClientMessageToAll(COLOR_RED, string);
                     
format(string, sizeof(string), "{E33667}[Kidnapping Ransom]: {E33667}$%d{FFFFFF}.", Value);
                     
SendClientMessageToAll(-1, string);
                     
format(string,sizeof(string), "{E33667}[Kidnapping]: You have been Kidnapping by %s(%d).", pName,playerid);
                    
SendClientMessage(targetid, -1, string);
                    
                    
SendClientMessage(targetid, -1, "You are released if something happens to the Kidnapper or the Vehicle.");
                    
                    
format(string, sizeof(string), "~b~%s", pName);
                    
TextDrawSetString(Textdraw641, string);
                    
                    
format(string, sizeof(string), "~y~Get To The Meet");
                    
TextDrawSetString(Textdraw638, string);
                    
                    
prokid(playerid);
                    
NoobKid(targetid);
                    
                    new 
rand = random(sizeof(KidnappingPos));
                    
SetPlayerRaceCheckpoint(playerid, 1, KidnappingPos[rand][0],KidnappingPos[rand][1],KidnappingPos[rand][2], 0,0,0, 3);
                    
CompleteKidnap[playerid] = 1;
                    
                    
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 4);
                    
SetPlayerColor(playerid, COLOR_ORANGE);
                    
GameTextForPlayer(targetid, "~Y~You ~p~are ~r~Kidnapping...", 10000, 5);
                    
GameTextForPlayer(playerid, "~r~Kidnapping...", 10000, 5);
                    
SetTimerEx("antispamkid", ANTISPAM_TIME*60000, false, "d", playerid);
                    
ransom[playerid] = 1;
                }
                else
                {
                    
SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Please wait before kidnapping other's players.");
                }
            }
            else
                {
                    
SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You are not in any vehicle.");
                }
        }
        else
        {
            
SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You must be a driver and enemy player must be passenger.");
        }
    }
    else
    {
         
SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Minimum amount to Set a Price of kidnapping a person with is +$25.000!");
    }
    return 
1;
} 
PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
CompleteKidnap[playerid] == 1)
    {
        new 
targetid;
        
kidnapper1[targetid] = playerid;
         new 
Value;
        
Money[playerid] = Value;
        new 
string[256];
        new 
tName[MAX_PLAYER_NAME];
        
GetPlayerName(targetid, tName, sizeof(tName));
        
SetPlayerHealth(targetid, 0.0);
        
GivePlayerMoney(playerid, Money[playerid]);
        
format(string, sizeof(string), "{0BEA00}[Kidnapping]: {FFFFFF}Player {FF9F00}%s(%d) {FFFFFF}has {FF0000}DEAD {FFFFFF}by the {E33667}Kidnapping {FFFFFF}by user {FF9F00}%s(%d){FFFFFF}.", tName,targetid, PlayerName(playerid), playerid);
        
SendClientMessageToAll(-1, string);
        
format(string, sizeof(string), "{0BEA00}[Money]:{FFFFFF} You have killed {FF9F00}%s(%d) {FFFFFF}by the {E33667}Kidnapping {FFFFFF}and you {E33667}Received{FFFFFF}:{0BEA00}$%d{FFFFFF}.", TargetName(targetid),targetid, Money[playerid]);
        
SendClientMessage(playerid, -1, string);
        
GameTextForPlayer(targetid, "~N~~N~~R~DEAD BY THE ~Y~KIDNAPPING~R~..", 5000 , 5);
        
format(string,sizeof(string), "~n~~n~~w~SOLD %s[%d]~n~TO A ~p~TRAFFICKER ~w~FOR ~G~%$d.", TargetName(targetid), targetid, Money[playerid]);
        
GameTextForPlayer(playerid, string, 5000, 5);
        
DisablePlayerRaceCheckpoint(playerid);
        
CompleteKidnap[playerid] = 0;
        
prokidText(playerid);
        
NoobKidText(targetid);
    }
    return 
1;
} 
Reply
#2

COMMAND
PHP код:
kidnapper1[playerid] = targetid; 
instead of
PHP код:
kidnapper1[playerid] = playerid; 
OnPlayerEnterRaceCheckpoint
PHP код:
new targetid= kidnapper1[playerid]; 
instead of
PHP код:
new targetid; 
kidnapper1[targetid] = playerid; 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)