SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 28/08/2012, 04:13 AM   #1
UnknownGamer
Gangsta
 
UnknownGamer's Avatar
 
Join Date: Apr 2012
Location: 127.0.0.1
Posts: 512
Reputation: 33
Default Car Destroy

Code:
	new currentveh;
	new currentveh2;
 	currentveh = PlayerInfo[playerid][pPcarkey];
 	currentveh2 = PlayerInfo[playerid][pPcarkey2];
	DestroyVehicle(currentveh);
	DestroyVehicle(currentveh2);
so i added that in, Onplayerdisconnect, how would I make it re-spawn when they log back in, I tried the following under Onplayerspawn but didnt work?

Code:
			// CAR RELOAD COMMAND //
			LoadCar();
			new scurrentveh;
			new scurrentveh2;
 			scurrentveh = PlayerInfo[playerid][pPcarkey];
 			scurrentveh2 = PlayerInfo[playerid][pPcarkey2];
 			CreateVehicle(CarInfo[scurrentveh][cModel],CarInfo[scurrentveh][cLocationx],CarInfo[scurrentveh][cLocationy],CarInfo[scurrentveh][cLocationz]+1.0,CarInfo[scurrentveh][cAngle],CarInfo[scurrentveh][cColorOne],CarInfo[scurrentveh][cColorTwo],60000);
     		CreateVehicle(CarInfo[scurrentveh2][cModel],CarInfo[scurrentveh2][cLocationx],CarInfo[scurrentveh2][cLocationy],CarInfo[scurrentveh2][cLocationz]+1.0,CarInfo[scurrentveh2][cAngle],CarInfo[scurrentveh2][cColorOne],CarInfo[scurrentveh2][cColorTwo],60000);
 			// CAR LOAD //
__________________
Ravens MySQL Gamemode - New Job System been developed!

Ravens Programmer Position is now taken.
UnknownGamer is offline   Reply With Quote
Old 28/08/2012, 04:19 AM   #2
lamarr007
Huge Clucker
 
lamarr007's Avatar
 
Join Date: Aug 2011
Location: Czech Republic
Posts: 241
Reputation: 19
Default Re: Car Destroy

Are you using INI system or MySQL for saving player data?
__________________
I have cool Stunt/Mods/Freeroam server with CZ/EN translate.. If you want it, PM me..
lamarr007 is offline   Reply With Quote
Old 28/08/2012, 04:48 AM   #3
UnknownGamer
Gangsta
 
UnknownGamer's Avatar
 
Join Date: Apr 2012
Location: 127.0.0.1
Posts: 512
Reputation: 33
Default Re: Car Destroy

INI systems
__________________
Ravens MySQL Gamemode - New Job System been developed!

Ravens Programmer Position is now taken.
UnknownGamer is offline   Reply With Quote
Old 28/08/2012, 05:30 AM   #4
lamarr007
Huge Clucker
 
lamarr007's Avatar
 
Join Date: Aug 2011
Location: Czech Republic
Posts: 241
Reputation: 19
Default Re: Car Destroy

Dini or Y_INI or?
__________________
I have cool Stunt/Mods/Freeroam server with CZ/EN translate.. If you want it, PM me..
lamarr007 is offline   Reply With Quote
Old 28/08/2012, 05:43 AM   #5
UnknownGamer
Gangsta
 
UnknownGamer's Avatar
 
Join Date: Apr 2012
Location: 127.0.0.1
Posts: 512
Reputation: 33
Default Re: Car Destroy

DINI, How wud i make car respawn?
__________________
Ravens MySQL Gamemode - New Job System been developed!

Ravens Programmer Position is now taken.
UnknownGamer is offline   Reply With Quote
Old 28/08/2012, 06:15 AM   #6
lamarr007
Huge Clucker
 
lamarr007's Avatar
 
Join Date: Aug 2011
Location: Czech Republic
Posts: 241
Reputation: 19
Default Re: Car Destroy

pawn Code:
public OnPlayerConnect(playerid)
{
    new model = dini_Int("yourplayerfile", "VehicleModel");
    if(model != 0)
    {
        PlayerInfo[playerid][pPcarkey] = CreateVehicle(model, Float:dini_Float("yourplayerfile", "VehicleX"), Float:dini_Float("yourplayerfile", "VehicleY"), Float:dini_Float("yourplayerfile", "VehicleZ"), Float:dini_Float("yourplayerfile", "VehicleAngle"), -1, -1, 60);
    }
    return 1;
}
pawn Code:
public OnPlayerDisconnect(playerid)
{
    new Float:VX, Float:VY, Float:VZ, Float:AN;
    GetVehiclePos(PlayerInfo[playerid][pPcarkey], Float:VX, Float:VY, Float:VZ);
    GetVehicleZAngle(PlayerInfo[playerid][pPcarkey], Float:AN);
    dini_IntSet("yourplayerfile", "VehicleModel", CarInfo[scurrentveh][cModel]);
    dini_FloatSet("yourplayerfile","VehicleX",VX);
    dini_FloatSet("yourplayerfile","VehicleY",VY);
    dini_FloatSet("yourplayerfile","VehicleY",VZ);
    dini_FloatSet("yourplayerfile","VehicleAngle",AN);
    return 1;
}

Try
__________________
I have cool Stunt/Mods/Freeroam server with CZ/EN translate.. If you want it, PM me..
lamarr007 is offline   Reply With Quote
Old 28/08/2012, 01:27 PM   #7
UnknownGamer
Gangsta
 
UnknownGamer's Avatar
 
Join Date: Apr 2012
Location: 127.0.0.1
Posts: 512
Reputation: 33
Default Re: Car Destroy

yourplayerfile,

that wont work as it needs to spawn from playerid

Also get unreachable code errors
__________________
Ravens MySQL Gamemode - New Job System been developed!

Ravens Programmer Position is now taken.
UnknownGamer is offline   Reply With Quote
Old 28/08/2012, 05:05 PM   #8
lamarr007
Huge Clucker
 
lamarr007's Avatar
 
Join Date: Aug 2011
Location: Czech Republic
Posts: 241
Reputation: 19
Default Re: Car Destroy

I don┤t know, what is your variable, which save player┤s vehicle.. and i don┤t know, what is your path (stock) to get player file.. (therefore you get errors with yourplayerfile variable)

Example of my stock function to get player path
pawn Code:
stock UserPath(playerid)
{
new path[48];
format(path, sizeof(path), "/data/players/%s.ini", GetName(playerid));
return path;
}
__________________
I have cool Stunt/Mods/Freeroam server with CZ/EN translate.. If you want it, PM me..
lamarr007 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
Destroy .amx Ihsan-Cingisiz Help Archive 9 27/04/2011 04:54 PM
Destroy a car when NO-ONE is in it! ricardo178 Help Archive 11 24/01/2011 01:35 PM
To destroy car xxjackoxx Help Archive 1 05/03/2010 11:00 AM
Car destroy jaksimaksi Help Archive 2 27/12/2009 07:59 PM


All times are GMT. The time now is 12:22 AM.


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