onplayerkeystatechange - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: onplayerkeystatechange (
/showthread.php?tid=233585)
onplayerkeystatechange -
DeltaAirlines12 - 02.03.2011
I have this
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (oldkeys == KEY_SPRINT || newkeys == KEY_SPRINT)
{
if (IsPlayerSteppingInVehicle[playerid] > -1)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerVehicleID(i) == IsPlayerSteppingInVehicle[playerid] && i != playerid)
{
new Float:x,Float:y,Float:z,pName[28],string[128];
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z);
IsPlayerSteppingInVehicle[playerid] = -1;
Kick(playerid);
}
}
}
}
}
but i need to add this onto that callback also
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING(KEY_FIRE))
{
ammo[playerid] = GetPlayerAmmo(playerid);
weapon[playerid] = GetPlayerWeapon(playerid);
if(!IsValidWeapon(weapon[playerid])) return 0;
for(new i=0; i<7;i++)
{
n_ammo[playerid] = GetPlayerAmmo(playerid);
n_weapon[playerid] = GetPlayerWeapon(playerid);
}
if(n_weapon[playerid] == weapon[playerid] && n_ammo[playerid] == ammo[playerid])
{
if(cheatdetect[playerid] > 1)
{
Ban(playerid);
}
}
}
return 1;
}
can someone tell me how to add them, i keep trying but 250+ errors come up. thanks
Re: onplayerkeystatechange -
admantis - 02.03.2011
maybe if you show the errors
Re: onplayerkeystatechange -
Mean - 02.03.2011
When you get 26 errors, pawno will just stop with compiling and show them to you, as ****** said, you probbably have warnings. If you have the "Loose Indentation" warning, fix the indenting:
pawn Код:
// Good indentation
CMD:abcd( playerid, params[ ] )
{
SendClientMessage( playerid, 0xAAAAAA, "This is" );
return SendClientMessage( playerid, 0xAAAAAA, "SPARTAAAAAAA!!!" );
}
pawn Код:
// Bad indentation
CMD:abcd( playerid, params[ ] )
{
SendClientMessage( playerid, 0xAAAAAA, "This is" );
return SendClientMessage( playerid, 0xAAAAAA, "SPARTAAAAAAA!!!" );
// Meaning your code isn't sorted well.
}
You can fix the warning by sorting out the code, or putting this at top of your script to ignore the warnings
But, it's better to indent your code.
Re: onplayerkeystatechange -
Mean - 02.03.2011
I said, it's better to indent the code ^^. I am just saying it is a solution, but not the best solution.
Re: onplayerkeystatechange -
Sasino97 - 02.03.2011
What's that...?
Re: onplayerkeystatechange -
Sasino97 - 02.03.2011
Quote:
Originally Posted by ******
|
Thanks, I didn't see that.