08.02.2010, 04:18
Just checking, you want players to be able to use only these two, or you don't want them to be able to?
Try putting in a few printf statements to check if your admin is set correctly.
Although I am not sure why you are doing it on keystate, seems a waste to have this check every time they press a key when you can just do it under onplayerstatechange.
Here is the code that will kick non admins out of hydras or rustlers.
Try putting in a few printf statements to check if your admin is set correctly.
Код:
//============================================================================== public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { printf("player(%d), level set to %d", playerid, PlayerInfo[playerid][Level]); if(PlayerInfo[playerid][Level] < 1) { print("Player is not an admin"); new vehicleid = GetPlayerVehicleID(playerid); new modelid = GetVehicleModel(vehicleid); if(modelid != 476 && modelid != 520) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!"); } } return 1; }
Here is the code that will kick non admins out of hydras or rustlers.
Код:
//============================================================================== public OnPlayerStateChange(playerid, newstate, oldstate) { printf("player(%d), level set to %d", playerid, PlayerInfo[playerid][Level]); if(newstate==PLAYER_STATE_DRIVER && PlayerInfo[playerid][Level] < 1) { print("Player is not an admin"); new vehicleid = GetPlayerVehicleID(playerid); new modelid = GetVehicleModel(vehicleid); if(newkeys == 2 || newkeys == 3) { if(modelid == 476 || modelid == 520) { RemovePlayerFromVehicle(playerid); SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!"); } } } return 1; }