PVar problem.... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PVar problem.... (
/showthread.php?tid=282578)
PVar problem.... -
Shetch - 11.09.2011
Hello scripter. So i have a /mycar command, with puts you in your locked vehicle, and i have a export system.
What i was trying to do was, so that if a players locked car is exportable, then u can't use the command /mycar....
It's all based on PVars. Let me show you.
MYCAR command:
Код:
dcmd_mycar(playerid,params[])
{
#pragma unused params
new veh[MAX_PLAYERS];
veh[playerid] = GetPlayerVehicleID(playerid);
new ExportCarID1[MAX_PLAYERS];
new ExportCarID2[MAX_PLAYERS];
new ExportCarID3[MAX_PLAYERS];
new LockedCarModel[MAX_PLAYERS];
LockedCarModel[playerid] = GetVehicleModel(LockedCar[playerid]);
ExportCarID1[playerid] = GetPVarInt(playerid,"ExportCar1");
ExportCarID2[playerid] = GetPVarInt(playerid,"ExportCar2");
ExportCarID3[playerid] = GetPVarInt(playerid,"ExportCar3");
new Float:X,Float:Y,Float:Z,Float:Angle,interior;
if(GetPlayerScore(playerid) < 3) return SendClientMessage(playerid, GREY, "ERROR: You need 3rd level.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, GREY, "ERROR: You have to be on foot to use this.");
if(LockedCar[playerid] == ExportCarID1[playerid] || LockedCar[playerid] == ExportCarID2[playerid] || LockedCar[playerid] == ExportCarID3[playerid]) return SendClientMessage(playerid, GREY, "ERROR: your locked car is on the export list, so u can't use this!");
if(HasACarLocked[playerid] == 0) return SendClientMessage(playerid, GREY, "ERROR: You havent locked any car!");
GetPlayerPos(playerid, X,Y,Z);
GetPlayerFacingAngle(playerid,Angle);
interior = GetPlayerInterior(playerid);
SetVehiclePos(LockedCar[playerid], X,Y,Z);
LinkVehicleToInterior(LockedCar[playerid],interior);
SetVehicleZAngle(LockedCar[playerid],Angle);
PutPlayerInVehicle(playerid, LockedCar[playerid], 0);
return 1;
}
Now here's the part where export system saves the PVar's:
This is a 1sec timer....
Код:
public ScanVehicleStatus()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
new carmodel = GetVehicleModel(GetPlayerVehicleID(i));
if (carmodel == carselect[0] || carmodel == carselect[1] || carmodel == carselect[2])
{
MiniMission[i] = CHECKPOINT_EXPORT;
}
}
}
for (new i = 0; i < MAX_PLAYERS; i++)
{
SetPVarInt(i,"ExportCar1",carselect[0]);
SetPVarInt(i,"ExportCar2",carselect[1]);
SetPVarInt(i,"ExportCar3",carselect[2]);
}
return 1;
}
When i'm in a exportable vehicle and i type /mycar, it doesnt show the error message, it just puts me itn to the exportable car.
Help would be very epriciated.
Re: PVar problem.... -
Mean - 11.09.2011
And what's the problem?
Re: PVar problem.... -
Shetch - 11.09.2011
When i'm in a exportable vehicle and i type /mycar, it doesnt show the error message, it just puts me itn to the exportable car.
Re: PVar problem.... -
Shetch - 11.09.2011
Guys, i really need help on this. :/
Re: PVar problem.... -
Shetch - 11.09.2011
Please help...
Re: PVar problem.... -
[GTA]AmericanGangster - 11.09.2011
did you put the #DEFINE COLORS?
Re: PVar problem.... -
Shetch - 11.09.2011
I'm not that stupid u know.
For some reason it just doesnt save the exportable car's id.