SA-MP Forums Archive
help the key - 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 the key (/showthread.php?tid=450453)



help the key - Deividasltu - 13.07.2013

Hello everyone i want to help for just playing with the keys script or tutorial on mysql


Re: help the key - JetForever - 13.07.2013

OK. I will try to explain you.
Using keys(enter, space etc..)
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
On this calback you can use keys.
Where is link of all keys who you can use:https://sampwiki.blast.hk/wiki/Keys
example:
Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (playeradmin[playerid]//If player is admin
{
GameTextForPlayer(playerid, "~w~Yea you are admin!",5000,1);//Show text for player
if (newkeys)//if any button pressed from this site which are described https://sampwiki.blast.hk/wiki/Keys
{
GameTextForPlayer(playerid, "~w~Yea you are admin and you pressed button!",5000,1);//Show text
}
}
}

Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PlayerIsCop[playerid]/If player is Cop
{
GameTextForPlayer(playerid, "~w~Yea you are Cop!",5000,1);//Show text for player
if (newkeys == KEY_CROUCH )//Is shows how to use buttons KEY_CROUCH is c button
{
GameTextForPlayer(playerid, "~w~Yea you are Cop and pressed C button!",5000,1);//Show text for player
}
}
}

To use mysql you need server like Wamp or something like that. Create database and tables in phpmyadmin and when is hardest part left: Write code in pawn. If you will use mysql when use R7 plugin.Where is link how to use it https://sampforum.blast.hk/showthread.php?tid=337810
Sorry for bad english
If I helped +Rep