[PROBLEM] Tram not accessible
#1

In this way, I can get into all rc vehicles except the tram...

Why

PHP код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <cuffs>
#define RC_ENTER_RANGE 8
new RCVehicles[] = {
        
441,
        
464,
        
465,
        
501,
        
564,
        
594,
        
449
};
main()
{
    print(
"\n----------------------------------");
    print(
" By Crystal94");
    print(
"----------------------------------\n");
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
        if(
newkeys 16)
        {
                new 
Float:x,Float:y,Float:z;
                if(
IsPlayerInAnyVehicle(playerid) && IsVehicleRCVehicle(GetPlayerVehicleID(playerid)))
                {
                        
GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
                        
SetPlayerPos(playerid,x,y,z+1.8);
                        return 
1;
                }
                for(new 
vMAX_VEHICLESv++)
                {
                        
GetVehiclePos(v,x,y,z);
                        if(
IsPlayerInRangeOfPoint(playerid,RC_ENTER_RANGE,x,y,z) && IsVehicleRCVehicle(v))
                        {
                        
PutPlayerInVehicle(playerid,v,0);
                        return 
1;
                        }
                }
        }
        return 
1;
}
stock IsVehicleRCVehicle(vehicleid)
{
        for(new 
v6v++)
        {
            if(
GetVehicleModel(vehicleid) == RCVehicles[v]) return 1;
        }
        return 
0;

Reply
#2

That's what you get when people refuse to use sizeof. Specifically this:
PHP код:
for(new v6v++) 
It checks the first 6 items in the array but now there are 7 items so the last item isn't checked at all. If it had been done properly it would look like this:
PHP код:
for(new vsizeof RCVehiclesv++) 
Reply
#3

Okay, come in, but when I want to get out there is a problem, because if I press enter, Cj comes out, but for a fraction of a second and then returns inside.

Holding Enter together the directional keys, somehow I can go out, but the camera stays on the tram, like in this image:

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)