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(playeridparams[])
{
    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(playeridCOLOR_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]"targetidValue)) 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(targetidtNamesizeof(tName));
    
GetPlayerName(playeridpNamesizeof(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(targetid0);
                    
format(string,sizeof(string), "{E33667}[Kidnapping]: {FFFFFF}Player {E33667}%s(%d) {FFFFFF}has been {E33667}KIDNAPPING {FFFFFF}by {E33667}%s(%d){FFFFFF}."tName,targetidpName,playerid);
                     
SendClientMessageToAll(COLOR_REDstring);
                     
format(stringsizeof(string), "{E33667}[Kidnapping Ransom]: {E33667}$%d{FFFFFF}."Value);
                     
SendClientMessageToAll(-1string);
                     
format(string,sizeof(string), "{E33667}[Kidnapping]: You have been Kidnapping by %s(%d)."pName,playerid);
                    
SendClientMessage(targetid, -1string);
                    
                    
SendClientMessage(targetid, -1"You are released if something happens to the Kidnapper or the Vehicle.");
                    
                    
format(stringsizeof(string), "~b~%s"pName);
                    
TextDrawSetString(Textdraw641string);
                    
                    
format(stringsizeof(string), "~y~Get To The Meet");
                    
TextDrawSetString(Textdraw638string);
                    
                    
prokid(playerid);
                    
NoobKid(targetid);
                    
                    new 
rand random(sizeof(KidnappingPos));
                    
SetPlayerRaceCheckpoint(playerid1KidnappingPos[rand][0],KidnappingPos[rand][1],KidnappingPos[rand][2], 0,0,03);
                    
CompleteKidnap[playerid] = 1;
                    
                    
SetPlayerWantedLevel(playeridGetPlayerWantedLevel(playerid) + 4);
                    
SetPlayerColor(playeridCOLOR_ORANGE);
                    
GameTextForPlayer(targetid"~Y~You ~p~are ~r~Kidnapping..."100005);
                    
GameTextForPlayer(playerid"~r~Kidnapping..."100005);
                    
SetTimerEx("antispamkid"ANTISPAM_TIME*60000false"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(targetidtNamesizeof(tName));
        
SetPlayerHealth(targetid0.0);
        
GivePlayerMoney(playeridMoney[playerid]);
        
format(stringsizeof(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,targetidPlayerName(playerid), playerid);
        
SendClientMessageToAll(-1string);
        
format(stringsizeof(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),targetidMoney[playerid]);
        
SendClientMessage(playerid, -1string);
        
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), targetidMoney[playerid]);
        
GameTextForPlayer(playeridstring50005);
        
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 targetidkidnapper1[playerid]; 
instead of
PHP код:
new targetid
kidnapper1[targetid] = playerid
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)