OnPlayerStateChange
#1

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!?
Reply
#2

Get the name of the one who is entering the vehicle (OnPlayerEnterVehicle) and compare it to Carlist[playerid][owner].
Reply
#3

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?
Reply
#4

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].
Reply
#5

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)
Reply
#6

Anyone with a solution to my problem??
Reply
#7

*BUMP*

There must be someone who can help me with this I really need this
Reply
#8

Help...?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)