Help with a cmd..
#1

I need help, im making a /gbob (getbackonbike) // (Enables the Alt key being pressed to get back on bike) command where if you fall off and press a key it will get you back on it... kind of like anti fall but not automatic

Top of script
Код:
new PInCar [MAX_PLAYERS];
new WhatCar[MAX_PLAYERS]; // GetPlayerVehicleID
OnPlayerCommandText
Код:
if(strcmp(cmdtext,"/gbob",true)== 0) {
if (PInCar[playerid] == 1)
{
SendClientMessage(playerid,COLOR_RED,"You can now get back on your bike by pressing ALT.");
}
return 1;
}
OnPlayerExitVehicle
Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	PInCar[playerid] = 0;
	return 1;
}
OnPlayerStateChange
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER)
        {
                if(newstate == PLAYER_STATE_ONFOOT)
                {
                        if(PInCar[playerid] == 1)
                        {

                                PutPlayerInVehicle(playerid, WhatCar[playerid], Driver); // WhatCar = GetPlayerVehicleID
	return 1;
}
im kinda stuck from here... I got 23 errors using that and cannot work out how to bind it to a key ( KEY_WALK) // lalt
Reply
#2

Well, for the very obvious part that you forgot to close 3 brackets, this code won't work properly anyway because OnPlayerExitVehicle is not called when you fall of your bike.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Well, for the very obvious part that you forgot to close 3 brackets, this code won't work properly anyway because OnPlayerExitVehicle is not called when you fall of your bike.
Well i'm kinda new to PAWN, could you help me a bit?
Reply
#4

use OnPlayerKeyStateChange to detect if player press ALT after felt
Reply
#5

Quote:
Originally Posted by |_ⒾⓇⓄN_ⒹⓄG_|
Посмотреть сообщение
use OnPlayerKeyStateChange to detect if player press ALT after felt
I tried, but i have no clue how to get it working
Reply
#6

You are opening alot of brackets at: OnPlayerStateChange but you never closed them.
Reply
#7

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
You are opening alot of brackets at: OnPlayerStateChange but you never closed them.
Yes i fixed that but now it just works as an anti fall, i want to press alt to get back on my vehicle and not automatic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)