Cmd help
#1

Why wont this code work?
when i type the command /cancelcar

it only "TogglePlayerControllable(playerid, 1);" in a few seconds

then it goes back to "TogglePlayerControllable(playerid, 0);" i want it to stop toggleplayerconstrol..

pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
        {
        TogglePlayerControllable(playerid, 1);
        RemovePlayerFromVehicle(playerid);
        return 1;
        }
Reply
#2

0 ( false ) means the player is frozen
1 ( true ) means the player is not frozen
Reply
#3

Quote:
Originally Posted by Rachael
Посмотреть сообщение
0 ( false ) means the player is frozen
1 ( true ) means the player is not frozen
Yes it should work then.. but i prob, found the problem i added a timer when you enter the car
only after X seconds it freeze

pawn Код:
forward Control(playerid);
pawn Код:
public Control(playerid)
    {
    TogglePlayerControllable(playerid, 0);
    return 1;
    }
pawn Код:
if(strmatch(VehicleSystem[IsBuyableCar[vehicleid]][Owner],"Unbought"))
            {
            format(string,sizeof(string),"[ » ] Vehicle ID:  %d / Name: %s / Price: %d$ !",VehicleSystem[IsBuyableCar[vehicleid]][CarID],VehicleSystem[IsBuyableCar[vehicleid]][Name],VehicleSystem[IsBuyableCar[vehicleid]][Price]);
            SendClientMessage(playerid,COLOR_GREY,string);
            SetTimerEx("Control",3000,1,"i",playerid);
            }
think there is a problem with that.. but cant see what
and i tryed add a "return 1;" didnt work..
Reply
#4

Quote:
Originally Posted by FrankC
Посмотреть сообщение
Why wont this code work?
when i type the command /cancelcar

it only "TogglePlayerControllable(playerid, 1);" in a few seconds

then it goes back to "TogglePlayerControllable(playerid, 0);" i want it to stop toggleplayerconstrol..

pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
        {
        TogglePlayerControllable(playerid, 1);
        RemovePlayerFromVehicle(playerid);
        return 1;
        }
Have you tried-...

pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        return 1;
        }
Don't know if it'll work though, but it will make the player controllable after he's been removed from the vehicle.
Reply
#5

Quote:
Originally Posted by DevilG
Посмотреть сообщение
Have you tried-...

pawn Код:
if (strcmp(cmd, "/cancelcar", true) ==0)
        {
        RemovePlayerFromVehicle(playerid);
        TogglePlayerControllable(playerid, 1);
        return 1;
        }
Don't know if it'll work though, but it will make the player controllable after he's been removed from the vehicle.
Nah.. didnt work
Reply
#6

You never kill the timer, so it will continue freezing each time it get's called.
To fix, easily change '1' to '0':

pawn Код:
SetTimerEx("Control",3000,0,"i",playerid);
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
You never kill the timer, so it will continue freezing each time it get's called.
To fix, easily change '1' to '0':

pawn Код:
SetTimerEx("Control",3000,0,"i",playerid);
Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)