CMD problem ( need help ASAP )
#1

Just want to use a cmd, if that player in a vehicle then he can use the CMD,
Also there will some more condition

Here i want

PHP код:
CMD:das(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid) && !PlayerInfo[playerid][pMember] == 10 && !PlayerInfo[playerid][pLeader] == 10 && !PlayerInfo[playerid][pJob] == 17 && !PlayerInfo[playerid][pJob2] == 17 && !PlayerInfo[playerid][pTaxiLicense] == 1)
    {
        
SendClientMessage(playerid, -1"You must be in any vehicle to use this command.");//1
        
return 1;
    }
    ...
Other codes.
    return 
1;

Now, my problem is, it shows no error or warning, but it don't work when i use this cmd. Like, if i am not in the car, it even don't show the point //1 line.

What should i do?
Any quick fix please.
Reply
#2

-Removed-
Reply
#3

You had
PHP код:
IsPlayerInAnyVehicle(playerid
that means, if the player is in the vehicle.
but you should've had it like
PHP код:
!IsPlayerInAnyVehicle(playerid
that "!" means like NO.
Reply
#4

Quote:
Originally Posted by Karan007
Посмотреть сообщение
Try this

PHP код:
CMD:das(playeridparams[]) 

    if(!
IsPlayerInAnyVehicle(playerid) && !PlayerInfo[playerid][pMember] == 10 && !PlayerInfo[playerid][pLeader] == 10 && !PlayerInfo[playerid][pJob] == 17 && !PlayerInfo[playerid][pJob2] == 17 && !PlayerInfo[playerid][pTaxiLicense] == 1
    { 
        
SendClientMessage(playerid, -1"You must be in any vehicle to use this command.");//1 
        
return 1
    } 
    ...
Other codes
    return 
1

It my bad to not write ! after IsPlayerInAnyVehicle . It not the main problem. I just tried with ! and without this, mean with yse and also no .
Quote:
Originally Posted by saffierr
Посмотреть сообщение
You had
PHP код:
IsPlayerInAnyVehicle(playerid
that means, if the player is in the vehicle.
but you should've had it like
PHP код:
!IsPlayerInAnyVehicle(playerid
that "!" means like NO.
I know about it, I am not asking about this knowledge -_-
Reply
#5

-Removed-
Reply
#6

you can't do it like this
Код:
!PlayerInfo[playerid][pMember] == 10
this is the proper use
Код:
PlayerInfo[playerid][pMember] != 10
the whole thing:
Код:
CMD:das(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pLeader] != 10 && PlayerInfo[playerid][pJob] != 17 && PlayerInfo[playerid][pJob2] != 17 && PlayerInfo[playerid][pTaxiLicense] != 1)
    {
        SendClientMessage(playerid, -1, "You must be in any vehicle to use this command.");//1
        return 1;
    }

    ...Other codes.

    return 1;
}
Reply
#7

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
you can't do it like this
Код:
!PlayerInfo[playerid][pMember] == 10
this is the proper use
Код:
PlayerInfo[playerid][pMember] != 10
the whole thing:
Код:
CMD:das(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pLeader] != 10 && PlayerInfo[playerid][pJob] != 17 && PlayerInfo[playerid][pJob2] != 17 && PlayerInfo[playerid][pTaxiLicense] != 1)
    {
        SendClientMessage(playerid, -1, "You must be in any vehicle to use this command.");//1
        return 1;
    }

    ...Other codes.

    return 1;
}
Dammmn! I have forgot this . Thanks for the help buddy.
Reply
#8

Quote:
Originally Posted by lucamsx
Посмотреть сообщение
you can't do it like this
Код:
!PlayerInfo[playerid][pMember] == 10
this is the proper use
Код:
PlayerInfo[playerid][pMember] != 10
the whole thing:
Код:
CMD:das(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][pMember] != 10 && PlayerInfo[playerid][pLeader] != 10 && PlayerInfo[playerid][pJob] != 17 && PlayerInfo[playerid][pJob2] != 17 && PlayerInfo[playerid][pTaxiLicense] != 1)
    {
        SendClientMessage(playerid, -1, "You must be in any vehicle to use this command.");//1
        return 1;
    }

    ...Other codes.

    return 1;
}
Ummm... YES, you can use it like that.

Binary NOT, '!', will cause any true to be false and vice-versa.
This:
Код:
(!(PlayerInfo[playerid][pMember] == 10))
is perfectly fine, but improper.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)