onplayerkeystatechange
#1

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
Reply
#2

maybe if you show the errors
Reply
#3

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
pawn Код:
#pragma tabsize 0
But, it's better to indent your code.
Reply
#4

I said, it's better to indent the code ^^. I am just saying it is a solution, but not the best solution.
Reply
#5

Quote:
pawn Код:
if (HOLDING(KEY_FIRE))
What's that...?
Reply
#6

Thanks, I didn't see that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)