OnPlayerStateChange - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerStateChange (
/showthread.php?tid=199230)
OnPlayerStateChange -
[DDC]Delight - 14.12.2010
Hello all,
I'm having an issue with my OnPlayerStateChange
Issue is this: I want to create vehicles which are only accessible for the owner.
It's used for a personal car system.
It saves the owner like this:
Код:
Carlist[playerid][owner]
Above code saves the Owner's NAME in a file.
Now in OnPlayerStateChange, it should check if the player whose entering the vehicle is the same as the Carlist[playerid][owner]
Ive tried tons of things but doesn't work can anyone help me out please!?
Re: OnPlayerStateChange -
Marcel - 14.12.2010
Get the name of the one who is entering the vehicle (
OnPlayerEnterVehicle) and compare it to Carlist[playerid][owner].
Re: OnPlayerStateChange -
[DDC]Delight - 14.12.2010
Quote:
Originally Posted by Marcel
Get the name of the one who is entering the vehicle ( OnPlayerEnterVehicle) and compare it to Carlist[playerid][owner].
|
That's my question how can I do this?
Re: OnPlayerStateChange -
Marcel - 14.12.2010
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName (playerid, pName, sizeof (pName));
if (strcmp (Carlist[playerid][owner], pName, true) == 0)
{
// It is true
}
else
{
// Not true.
}
return 1;
}
By the way, I think it is Carlist[
vehicleid] instead of Carlist[
playerid].
Re: OnPlayerStateChange -
[DDC]Delight - 14.12.2010
Now it does the following:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName (playerid, pName, sizeof (pName));
if (strcmp (Carlist[vehicleid][owner], pName, true) == 0)
{ // It is true
SendClientMessage(playerid, COLOR_YELLOW, "* Welcome");
}
else
{ // Not true.
SendClientMessage(playerid, COLOR_RED, "* EJECT");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
it Sends Welcome to me (if I enter any vehicle)
And it doesn't do anything to others
EDIT: The case that it sends me this message with any vehicle is fixed.
I need the part which kicks others out of my vehicle (Little Alarm System)
Re: OnPlayerStateChange -
[DDC]Delight - 15.12.2010
Anyone with a solution to my problem??
Re: OnPlayerStateChange -
[DDC]Delight - 16.12.2010
*BUMP*
There must be someone who can help me with this I really need this
Re: OnPlayerStateChange -
[DDC]Delight - 20.12.2010
Help...?