Car Destroy
#1

Код:
	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?

Код:
			// 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 //
Reply
#2

Are you using INI system or MySQL for saving player data?
Reply
#3

INI systems
Reply
#4

Dini or Y_INI or?
Reply
#5

DINI, How wud i make car respawn?
Reply
#6

pawn Код:
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 Код:
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
Reply
#7

yourplayerfile,

that wont work as it needs to spawn from playerid

Also get unreachable code errors
Reply
#8

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 Код:
stock UserPath(playerid)
{
new path[48];
format(path, sizeof(path), "/data/players/%s.ini", GetName(playerid));
return path;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)