Question [REP+] - 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: Question [REP+] (
/showthread.php?tid=591375)
Question [REP+] -
SecretBoss - 11.10.2015
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
Re: Question [REP+] -
Danzou - 11.10.2015
Ok..
Re: Question [REP+] -
SecretBoss - 11.10.2015
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
|
Re: Question [REP+] -
jlalt - 11.10.2015
make the result / response of the command and key on function example :
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
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;
}
Re: Question [REP+] -
SoFahim - 11.10.2015
It is possible to make.
Re: Question [REP+] -
SecretBoss - 12.10.2015
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
Re: Question [REP+] -
bgedition - 12.10.2015
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;
}
Re: Question [REP+] -
SecretBoss - 12.10.2015
I just asked if it possible to call a key lel, I want test something on my gamemode
Re: Question [REP+] -
bgedition - 12.10.2015
Okay, so I think this is impossible to call a key(I THINK) xD
Re: Question [REP+] -
S4D - 12.10.2015
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && newkeys & KEY_FIRE)
{
UnflipCar(GetPlayerVehicleID(playerid));
}
return 1;
}
UnflipCar(vehicleid)
{
new Float:angle;
GetVehicleZAngle(vehicleid, angle);
SetVehicleZAngle(vehicleid, angle);
return 1;
}
Then use this function in your command