Old car issue - 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: Old car issue (
/showthread.php?tid=299217)
Old car issue -
Qur - 24.11.2011
Hey.. sometimes when I use /oldcar I the number I get is 0..
Any reason why?
pawn Код:
if(strcmp(cmd, "/oldcar", true) == 0)
{
if(IsPlayerConnected(playerid))
{
format(string, sizeof(string), "Your old car was: %d",gLastCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
}
return 1;
}
Re: Old car issue -
Kayaque - 24.11.2011
Where do you get the information about your previous car?
OnPlayerEnterVehicle?
Re: Old car issue -
Qur - 24.11.2011
What do you mean?
Re: Old car issue -
Tomejus - 24.11.2011
EPIC. : D
Where do you set the "lastcar" variable at?
Re: Old car issue -
Kayaque - 24.11.2011
In what public do you store gLastCar[playerid] with the ID of the car?
example:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER) {gLastCar[playerid] == GetPlayerVehicleID(playerid);}
return 1;
}
Re: Old car issue -
Ash. - 24.11.2011
They won't have entered a vehicle since they connected.
They need to have entered a car for gLastCar[playerid] to have a vehicle ID in it.
Re: Old car issue -
Kayaque - 24.11.2011
A good tip would be to do like this;
pawn Код:
new gLastCar[MAX_PLAYERS] = -1;
if(strcmp(cmd, "/oldcar", true) == 0)
{
if(gLastCar[playerid] == -1) return SendClientMessage(playerid, COLOR_RED, "Error: You have not entered a car since you logged in.");
format(string, sizeof(string), "Your old car was: %d",gLastCar[playerid]);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
And then include what I wrote in the previous post;
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER) {gLastCar[playerid] == GetPlayerVehicleID(playerid);}
return 1;
}
Re: Old car issue -
Qur - 24.11.2011
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
new oldcar = gLastCar[playerid];
That's what I found.. its part of it.. so dont expect for return or close it
Re: Old car issue -
Qur - 25.11.2011
Still not fixed.. cant figure out why.. still saying the old car is 0... and so wierd cuz it worked and i didnt do anything to change it..
more ideas?
Re: Old car issue -
Ash. - 25.11.2011
How do you set it?