Help in Durby DeathMatch Vehicles [+rep]
#1

Guys i Have Create a Durby in my server and when a player death and veh explode player spawn with new veh and old vehicle spawn too so i want that vehicle distory or i tried too increase its respawn time but its not work here are code
PHP код:
onplayerdeath
if(VDMS[playerid] == 1)
    {
        
VDMS[playerid] = 1;
        if(
killerid != INVALID_PLAYER_ID)
        {
            if(
GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
            {
                new 
str[128];
                
format(str,sizeof(str),"%s Has Killed %s in Durby DeathMatch and Earn 15000.",killerid,playerid);
                
SendClientMessageToAll(COLOR_ORANGE,str);
                
SetPlayerScore(killerid,pInfo[killerid][pScore]++);
                
GivePlayerMoney(killerid,15000);
                
GameTextForPlayer(killerid,"Nice Shot!",3000,3);
                
GameTextForPlayer(playerid,"Well Tried.",3000,3);
                
PlayerPlaySound(killerid11490.00.00.0);
                
DestroyVehicle(GetPlayerVehicleID(killerid));
                if(
IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
            }
        }
     }
CMD:ddm(playerid,params[])
{
    if(
pInfo[playerid][pSpawned] == 0) return SendClientMessage(playerid,COLOR_RED,Death_msg);
    if(
VDMS[playerid] == 1) return SendClientMessage(playeridCOLOR_RED,"YOU Are Already in Durby DeathMatch,");
    if(
pInfo[playerid][pTeleport] == 1)
    {
        
        new 
str[128],str1[128],Veh;
         new 
Random random(sizeof(RandomVDMS));
        
SetPlayerPosEx(playeridRandomVDMS[Random][0], RandomVDMS[Random][1], RandomVDMS[Random][2],0.0,15,0);
        
SetPlayerFacingAngle(playeridRandomVDMS[Random][3]);
        
Veh CreateVehicle(504RandomVDMS[Random][0], RandomVDMS[Random][1], RandomVDMS[Random][2],RandomVDMS[Random][3],2,2,200*60000);
        
SetCameraBehindPlayer(playerid);
        
LinkVehicleToInterior(Veh15);
        
PlayerInVDMS[playerid]++;
        
PutPlayerInVehicle(playeridVeh,0);
        
GameTextForPlayer(playerid,"~y~Welcome to The ~r~Durby ~y~DeathMatch.",3000,3);
        
format(str,sizeof(str),"{84F6D7}%s: {FFA1AF}You Have Been Teleport To Durby DeathMatch.",PlayerName(playerid));
        
SendClientMessage(playerid,COLOR_RED,str);
        
format(str1,sizeof(str1),"%s: {FFA1AF}Has Been Teleport Durby DeathMatch. Type /ddm To Durby DeathMatch.",PlayerName(playerid));
        
SendClientMessageToAll(COLOR_LBLUE,str1);
        
pInfo[playerid][pTeleport] = 0;
        
VDMS[playerid] = 1;
        return 
1;
    }
    else
    
SendClientMessage(playerid,COLOR_RED,WAIT);
    return 
1;

Reply
#2

This should work, I guess.

PHP код:
forward DestoryVeh(playerid);
public 
DestoryVeh(playerid)
{
    
DestroyVehicle(GetPlayerVehicleID(playerid));
    return 
1;
}
public 
OnPlayerStateChangeplayeridnewstateoldstate )
{
    if(
VDMS[playerid] == 1)
    {
        if(
oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_WASTED )
        {
            
SetTimerEx("DestroyVeh"1000false"i"playerid);
        }
    }
    return 
1;

Reply
#3

and for again spawn in vehicle
this code will be work?
Quote:

if(VDMS[playerid] == 1)
{
if(newstate == PLAYER_STATE_ONFOOT)
{
new Float:X,Float:Y,Float:Z,Float:angle;
new Veh;
GetPlayerPos(playerid,X,Y,Z);
GetPlayerFacingAngle(playerid,angle);
Veh = CreateVehicle(504,X,Y,Z,angle,2,2,200*60000);
SetCameraBehindPlayer(playerid);
PutPlayerInVehicle(playerid, Veh,0);
LinkVehicleToInterior(Veh, 15);
}
}

Reply
#4

You want the player to spawn back into the derby after dying? You could;


PHP код:
public OnPlayerSpawn(playerid)
{
    if(
VDMS[playerid] == 1)
    {
    
CallRemoteFunction("OnPlayerCommandText","is"playerid"/ddm");
    }
    return 
1;

Reply
#5

not that i mean when player leave his vehicle so what should i do if he leave his vehicle i create this

PHP код:
if(VDMS[playerid] == 1)
    {
        if(
newstate == PLAYER_STATE_ONFOOT)
         {
              new 
Float:X,Float:Y,Float:Z,Float:angle;
            new 
Veh;
            
GetPlayerPos(playerid,X,Y,Z);
            
GetPlayerFacingAngle(playerid,angle);
              
Veh CreateVehicle(504,X,Y,Z,angle,2,2,200*60000);
            
SetCameraBehindPlayer(playerid);
            
PutPlayerInVehicle(playeridVeh,0);
            
LinkVehicleToInterior(Veh15);
               return 
1;
        } 
but its become bug player vehicle health become 1000
so now im thinking that
1st i create
PHP код:
new Float:VHelath
and then GetVehicleHealth(GVeh,VHealth); im confuse where i add this

and SetVehicleHealth(GVeh,Vhealth in my upper code what do you think is this will work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)