SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 05/03/2012, 02:05 AM   #1
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Vehicle Respawn

Well how can i make that whoever not driving the faction/organization vehicle only gets respawned, the one that has a driver in it will not respawn.

pawn Code:
CMD:ovrespawn(playerid,params[])
{
    if(PlayerData[playerid][Leader] == 0) return 0;
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car1]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car2]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car3]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car4]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car5]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car6]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car7]);
    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car8]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car1],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car2],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car3],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car4],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car5],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car6],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car7],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car8],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
    GetPlayerName(playerid,Nam,sizeof(Nam));
    foreach(Player,i)
    {
        if(PlayerData[i][Member] == PlayerData[playerid][Member])
        {
            format(str,sizeof(str),"[Org Info]: %s has respawned your organization vehicles",Nam);
            SCM(i,Niceyellow,str);
        }
    }
    return 1;
}
Tanush123 is offline   Reply With Quote
Old 05/03/2012, 02:18 AM   #2
2KY
Gangsta
 
2KY's Avatar
 
Join Date: Jan 2012
Location: United States
Posts: 949
Reputation: 166
Default Re: Vehicle Respawn

Try this:

pawn Code:
CMD:ovrespawn(playerid,params[])
{
    new Str[32];
   
    if(PlayerData[playerid][Leader] == 0) return 0;
        for( new v; v < 9; v++ ) {
            format( Str, sizeof( Str ), "OrgInfo[PlayerData[playerid][Member]][Car%d]", v);
            SetVehicleToRespawn( Str );
            ChangeVehicleColor(Str, OrgInfo[PlayerData[playerid][Member]][OCol1], OrgInfo[PlayerData[playerid][Member]][OCol2]);
        }
 
    GetPlayerName(playerid,Nam,sizeof(Nam));
    foreach(Player,i)
    {
        if(PlayerData[i][Member] == PlayerData[playerid][Member])
        {
            format(str,sizeof(str),"[Org Info]: %s has respawned your organization vehicles",Nam);
            SCM(i,Niceyellow,str);
        }
    }
    return 1;
}
__________________
Check out my wiki page
2KY is offline   Reply With Quote
Old 12/03/2012, 01:18 PM   #3
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: Vehicle Respawn

No i want that if one of the vehicle is being used, that vehicle won't respawn in the organization and the other organization vehicles the playerid is in are not being used, it will respawn.
Tanush123 is offline   Reply With Quote
Old 15/03/2012, 08:43 PM   #4
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: Vehicle Respawn

bump
Tanush123 is offline   Reply With Quote
Old 15/03/2012, 08:53 PM   #5
new121
Huge Clucker
 
Join Date: Feb 2012
Posts: 340
Reputation: 21
Default Re: Vehicle Respawn

pawn Code:
CMD:ovrespawn(playerid,params[])
{
    if(PlayerData[playerid][Leader] == 0) return 0;
         for(new i<MAX_PLAYERS; i++)
        {
            new carid;
            carid = GetPlayerVehicleID(i);
           if (carid != Car1 && carid != Car2 && carid != Car4 && carid != Car5 && carid != Car6 && carid != Car7 && carid != Car8)
           {
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car1]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car2]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car3]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car4]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car5]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car6]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car7]);
                    SetVehicleToRespawn(OrgInfo[PlayerData[playerid][Member]][Car8]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car1],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car2],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car3],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car4],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car5],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car6],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car7],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
                    ChangeVehicleColor(OrgInfo[PlayerData[playerid][Member]][Car8],OrgInfo[PlayerData[playerid][Member]][OCol1],OrgInfo[PlayerData[playerid][Member]][OCol2]);
            }
        }
    GetPlayerName(playerid,Nam,sizeof(Nam));
    foreach(Player,i)
    {
        if(PlayerData[i][Member] == PlayerData[playerid][Member])
        {
            format(str,sizeof(str),"[Org Info]: %s has respawned your organization vehicles",Nam);
            SCM(i,Niceyellow,str);
        }
    }
    return 1;
}
__________________
http://skilladept.com

Team Speak IP: 176.31.241.180

Server IP: 176.31.241.180:1337

From scratch role play script with an active player base please check us out!
new121 is offline   Reply With Quote
Old 15/03/2012, 11:02 PM   #6
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: Vehicle Respawn

That code above will not respawn if one of the org car is being used -_-. Ok imagine i am driving
pawn Code:
OrgInfo[PlayerData[playerid][Member]][Car2]
and the other ones are not used and i use /ovrespawn. Only these vehicles will respawned since they are not used
pawn Code:
OrgInfo[PlayerData[playerid][Member]][Car1]
OrgInfo[PlayerData[playerid][Member]][Car3]
OrgInfo[PlayerData[playerid][Member]][Car4]
OrgInfo[PlayerData[playerid][Member]][Car5]
OrgInfo[PlayerData[playerid][Member]][Car6]
OrgInfo[PlayerData[playerid][Member]][Car7]
OrgInfo[PlayerData[playerid][Member]][Car8]
Tanush123 is offline   Reply With Quote
Old 23/03/2012, 03:07 AM   #7
Tanush123
High-roller
 
Tanush123's Avatar
 
Join Date: Aug 2011
Posts: 1,022
Reputation: 65
Default Re: Vehicle Respawn

bump
Tanush123 is offline   Reply With Quote
Old 23/03/2012, 03:09 AM   #8
Reklez
Gangsta
 
Reklez's Avatar
 
Join Date: Mar 2012
Location: Philippines
Posts: 559
Reputation: 64
Default Re: Vehicle Respawn

use this function

pawn Code:
stock VehicleOccupied(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
    {
        if(IsPlayerInVehicle(i,vehicleid)) return 1;
    }
    return 0;
}

then do something like this

pawn Code:
if(!VehicleOccupied(vehid))
{
//your code respawn here
}

you must define the vehid yourself
__________________

Asking a reputation for Server Advertisement? You kidding me, You are totally n00b!
Reklez is offline   Reply With Quote
Old 23/03/2012, 03:30 AM   #9
new121
Huge Clucker
 
Join Date: Feb 2012
Posts: 340
Reputation: 21
Default Re: Vehicle Respawn

The code I posted will do what your asking.
__________________
http://skilladept.com

Team Speak IP: 176.31.241.180

Server IP: 176.31.241.180:1337

From scratch role play script with an active player base please check us out!
new121 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
vehicle respawn Chris_Mcgrifthd Help Archive 2 18/11/2010 10:44 PM
Vehicle respawn Aguylera Help Archive 3 31/10/2010 12:52 PM
Vehicle Respawn martynas Help Archive 4 30/09/2010 10:57 AM
[HELP] Vehicle respawn addinol Help Archive 3 24/02/2010 06:07 PM
Vehicle Not Respawn StrickenKid Help Archive 2 15/07/2009 01:46 AM


All times are GMT. The time now is 10:37 PM.


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