[Help] Very stranged problem ..
#1

Look, when i command that i build, when i'm outside of vehicle, it work's .
if i'm inside of vehicle, it isn't, please help me to fix it, there is the command:
PHP код:
if(!strcmp(cmd"/c"true) || !strcmp(cmd"/car"true))
    {
        if(
IsPlayerConnected(playerid))
        {
            new 
x_v[256];
            
x_v strtok(cmdtextidx);
              new 
carid IsPlayerNearAVehicle(playerid,13.5);
            if(!
strlen(x_v))
            {
                
SendClientMessage(playeridCOLOR_ORANGE"USE Way: (/C)ar [Action]");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 
1;
            }
            else if(!
strcmp(x_v"Lock",true))
            {
                if(!
strcmp(GetPlayerNameEx(playerid), CarInfo[carid][cOwnerName], true))
                {
                    if(
CarInfo[carid][cLocked] == 1)
                    {
                        
CarInfo[carid][cLocked] = 0;
                        
PlayerPlaySound(playerid11450.00.00.0);
                        
gCarLock[carid] = false;
                        
UnLockCar(carid);
                        
GameTextForPlayer(playerid"~g~Unlocked"70005);
                        
SetVehicleParamsForPlayer(carid,playerid,0,0);
                        
format(stringsizeof(string), "* %s unlocks his car"GetPlayerNameEx(playerid));
                        
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 
1;
                    }
                    else
                    {
                        
CarInfo[carid][cLocked] = 1;
                        
PlayerPlaySound(playerid11450.00.00.0);
                        
gCarLock[carid] = true;
                        
UnLockCar(carid);
                        
GameTextForPlayer(playerid"~r~Locked"70005);
                        
SetVehicleParamsForPlayer(carid,playerid,0,0);
                        
format(stringsizeof(string), "* %s locks his car"GetPlayerNameEx(playerid));
                        
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 
1;
                    }
                }
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_ORANGE"USE Way: (/C)ar [Action]");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 
1;
            }
        }
        return 
1;
    } 
Reply
#2

new carid = IsPlayerNearAVehicle(playerid,13.5);

thats the problem, if ur in the car, ur not near it
Reply
#3

I'll check it ..
Reply
#4

I fixed it to that:
PHP код:
if(!strcmp(cmd"/c"true) || !strcmp(cmd"/car"true))
    {
        if(
IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid) == || IsPlayerInAnyVehicle(playerid) == 0)
        {
            new 
x_v[256];
            
x_v strtok(cmdtextidx);
            if(!
strlen(x_v))
            {
                
SendClientMessage(playeridCOLOR_ORANGE"USE Way: (/C)ar [Action]");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 
1;
            }
            else if(!
strcmp(x_v"Lock",true))
            {
                new 
carid IsPlayerNearAVehicle(playerid,13.5);
                if(!
strcmp(GetPlayerNameEx(playerid), CarInfo[carid][cOwnerName], true))
                {
                    if(
CarInfo[carid][cLocked] == 1)
                    {
                        
CarInfo[carid][cLocked] = 0;
                        
PlayerPlaySound(playerid11450.00.00.0);
                        
gCarLock[carid] = false;
                        
UnLockCar(carid);
                        
GameTextForPlayer(playerid"~g~Unlocked"70005);
                        
SetVehicleParamsForPlayer(carid,playerid,0,0);
                        
format(stringsizeof(string), "* %s unlocks his car"GetPlayerNameEx(playerid));
                        
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 
1;
                    }
                    else
                    {
                        
CarInfo[carid][cLocked] = 1;
                        
PlayerPlaySound(playerid11450.00.00.0);
                        
gCarLock[carid] = true;
                        
UnLockCar(carid);
                        
GameTextForPlayer(playerid"~r~Locked"70005);
                        
SetVehicleParamsForPlayer(carid,playerid,0,0);
                        
format(stringsizeof(string), "* %s locks his car"GetPlayerNameEx(playerid));
                        
ProxDetector(20.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 
1;
                    }
                }
                return 
1;
            }
            else
            {
                
SendClientMessage(playeridCOLOR_ORANGE"USE Way: (/C)ar [Action]");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                
SendClientMessage(playeridCOLOR_WHITE"[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 
1;
            }
        }
        return 
1;
    } 
But there problem not fixed ..
( sorry about the double-post)
Reply
#5

pawn Код:
if(!strcmp(cmd, "/c", true) || !strcmp(cmd, "/car", true))
    {
        if(IsPlayerConnected(playerid)
        {
            new x_v[256];
            x_v = strtok(cmdtext, idx);
            if(!strlen(x_v))
            {
                SendClientMessage(playerid, COLOR_ORANGE, "USE Way: (/C)ar [Action]");
                SendClientMessage(playerid, COLOR_WHITE, "[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                SendClientMessage(playerid, COLOR_WHITE, "[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 1;
            }
            else if(!strcmp(x_v, "Lock",true))
            {
                new carid;
                carid = IsPlayerNearAVehicle(playerid,13.5);
                if(IsPlayerInAnyVehicle(playerid)) carid = GetPlayerVehicleID(playerid);
                if(!strcmp(GetPlayerNameEx(playerid), CarInfo[carid][cOwnerName], true))
                {
                    if(CarInfo[carid][cLocked] == 1)
                    {
                        CarInfo[carid][cLocked] = 0;
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        gCarLock[carid] = false;
                        UnLockCar(carid);
                        GameTextForPlayer(playerid, "~g~Unlocked", 7000, 5);
                        SetVehicleParamsForPlayer(carid,playerid,0,0);
                        format(string, sizeof(string), "* %s unlocks his car", GetPlayerNameEx(playerid));
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else
                    {
                        CarInfo[carid][cLocked] = 1;
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        gCarLock[carid] = true;
                        UnLockCar(carid);
                        GameTextForPlayer(playerid, "~r~Locked", 7000, 5);
                        SetVehicleParamsForPlayer(carid,playerid,0,0);
                        format(string, sizeof(string), "* %s locks his car", GetPlayerNameEx(playerid));
                        ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                }
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_ORANGE, "USE Way: (/C)ar [Action]");
                SendClientMessage(playerid, COLOR_WHITE, "[Actions] Lock, (Wi)ndow, Engine, Find, Park");
                SendClientMessage(playerid, COLOR_WHITE, "[Actions] (S)eat(B)elt, ASell, CSell, List");
                return 1;
            }
        }
        return 1;
    }
should work
Reply
#6

Still ...
If you didn't understood .
my problem is not the /c lock command .
When i'm outside of vehicle and i'm do /c or /car without any space .
It's told me the actions, if i'm inside of vehicle, its not told me even the actions ..
Reply
#7

What's the problem you are getting? be exact please
Reply
#8

Look at my post the upstairs, i edited ..
Reply
#9

Please, don't use [PHP] tags..........
Reply
#10

I Using ****** Chrome, i don't know why, but i dosen't have pawn tags here ..
someone can help me to fix it ?

If you didn't understood .
my problem is not the /c lock command .
When i'm outside of vehicle and i'm do /c or /car without any space .
It's told me the actions, if i'm inside of vehicle, its not told me even the actions ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)