SA-MP Forums Archive
Help with a cmd.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with a cmd.. (/showthread.php?tid=293179)



Help with a cmd.. - ryoere2k8 - 27.10.2011

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


Re: Help with a cmd.. - Vince - 27.10.2011

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.


Re: Help with a cmd.. - ryoere2k8 - 27.10.2011

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?


Re: Help with a cmd.. - |_ⒾⓇⓄN_ⒹⓄG_| - 27.10.2011

use OnPlayerKeyStateChange to detect if player press ALT after felt


Re: Help with a cmd.. - ryoere2k8 - 27.10.2011

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


Re: Help with a cmd.. - Kingunit - 27.10.2011

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


Re: Help with a cmd.. - ryoere2k8 - 27.10.2011

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