Question [REP+]
#1

Hey there,

I just wanted to ask if it is possible to call a key for example I have LALT button flip the car if the player will type /flip for example I want to call LALT button so it will flip the car (Just an example)

Thanks for reading
Reply
#2

Ok..
Reply
#3

Quote:
Originally Posted by Danzou
Посмотреть сообщение
Oh god, did you read this part? I know this way I am not noob

Quote:
Originally Posted by SecretBoss
Посмотреть сообщение
I just wanted to ask if it is possible to call a key
Reply
#4

make the result / response of the command and key on function example :
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys) {
if(
newkeys KEY_ACTION){
    
hiall();
    return 
1;
 }
return 
1;
}
CMD:hiall(playerid,params[]) {
hiall();
#pragma unused params
return 1;
}
hiall() {
    
SendClientMessageToAll(-1"HI ALL");
    return 
1;

Reply
#5

It is possible to make.
Reply
#6

You still can't understand, I just want a player with a function to call a key for example I want to make system execute the key ALT and it will do whatever I have on this button sth like this
Reply
#7

You just want to write the /flip code only once, right? Do this vise-versa instead of calling a key, call a command.

EDIT: this is modified snippet from cmd to stock from my tutorial: I hope it will work
Код:
stock forcecmd(cmd[]) {
    new Command[34], Params[129], string[50];
    if(sscanf(cmd, "s[32]S()[128]", Command, Params)) return 0;
    if(Command[0] == '/') strdel(Command, 0, 1);
    format(string, sizeof(string), "cmd_%s", Command);
    if(!CallLocalFunction(string, "s", isnull(Params) ? ("\1") : Params)) return 0;
    return 1;
}
Reply
#8

I just asked if it possible to call a key lel, I want test something on my gamemode
Reply
#9

Okay, so I think this is impossible to call a key(I THINK) xD
Reply
#10

PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER && newkeys KEY_FIRE)
    {
        
UnflipCar(GetPlayerVehicleID(playerid));
    }
    return 
1;
}
UnflipCar(vehicleid)
{
    new 
Float:angle;
    
GetVehicleZAngle(vehicleidangle);
    
SetVehicleZAngle(vehicleidangle);
    return 
1;

Then use this function in your command
Reply


Forum Jump:


Users browsing this thread: