Need help with car entering...
#1

So I have a problem on player enters vehicle.. Message doesn't shows up.

I tryed difrent ways but still nothing.. I really need some help..

Here is the code:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new CarCheck = GetPlayerVehicleID(playerid);
    if(CarCheck == Cars[GroveStreet])
    {
        if (Group_GetPlayer(gGSF, playerid)) // Can use the car.
        {
            SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You aren't in team Grove Street Crips");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    if(CarCheck == Cars[SevileCrips])
    {
        if (Group_GetPlayer(gSBF, playerid)) // Can use the car.
        {
            SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.*");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You aren't in team Sevile Beach Crips");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    if(CarCheck == Cars[VeronaBeachCrips])
    {
        if (Group_GetPlayer(gVBF, playerid)) // Can use the car.
        {
            SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.*");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You aren't in team Verona Beach Crips");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    if(CarCheck == Cars[TempleDriveCrips])
    {
        if (Group_GetPlayer(gTDF, playerid)) // Can use the car.
        {
            SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.*");
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You aren't in team Temple Drive Crips");
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    return 1;
}
Compiles without warnings and errors..
Reply
#2

Debug.
Reply
#3

Here is no debug needed.

You get the vehicleid
Код:
    new CarCheck = GetPlayerVehicleID(playerid)
BEFORE the player is in the vehicle. So it will return 0 and none of your car check will work.
Just use 'vehicleid'.

Although

Код:
            SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.*");
%s is not supported in SendClientMessage(); You have to get the player name at first then format a string and then send it via SendClientMessage()
Reply
#4

You think like this ? #define _DEBUG 7

It's dosn't show any bug.... And btw already there is * %s

then here it want it shows ..

pawn Код:
[23:51:45] Hooks_OnPlayerKeyStateChange called: 0, 0, 8
[23:51:45] Hooks_OnPlayerUpdate called: 0
[23:51:45] Hooks_OnPlayerUpdate called: 0
[23:51:45] Hooks_OnPlayerUpdate called: 0
[23:51:45] Hooks_OnPlayerUpdate called: 0
[23:51:45] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerUpdate called: 0
[23:51:46] Hooks_OnPlayerDisconnect called: 0, 1
[23:51:46] hook OnPlayerDisconnect called: 0, 1
[23:51:46] YSI_gABITSFunc called: 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, -1
[23:51:46] YSI_gABITSFunc called: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001, 1
[23:51:46] YSI_gABITSFunc called: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 127
[23:51:46] [part] Tony_Sentano has left the server (0:1)
Reply
#5

It doesnt shows bugs or errors because you did no mistake in the way you used the functions. But yo
u did a logical mistake like explained above.

Change this
Код:
new CarCheck = GetPlayerVehicleID(playerid);
to

Код:
new CarCheck = vehicleid;
and those messages
Код:
SendClientMessage(playerid, COLOR_RED, "* %s spins a key and tries to start vehicle engine.
to
Код:
new
	name_tag[MAX_PLAYER_NAME],
	string[128]
	;
GetPlayerName(playerid, name_tag, MAX_PLAYER_NAME);
format(string, sizeof string, "* %s spins a key and tries to start the vehicle engine.", name_tag);
SendClientMessage(playerid, COLOR_RED, string);
Reply
#6

Still the same...
Reply
#7

use on player state change

GetPlayerVehicleID returns the curent vehicle INSIDE, u are only entering the vehicle
Reply
#8

Quote:
Originally Posted by mastermax7777
Посмотреть сообщение
use on player state change

GetPlayerVehicleID returns the curent vehicle INSIDE, u are only entering the vehicle
thanks solved by my silly mistake Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)