描述
当玩家改变状态时调用此回调。例如,当玩家从车辆驾驶员变为步行时。姓名 | 描述 |
---|---|
playerid | 改变状态的玩家的ID。 |
newstate | 玩家的新状态。 |
oldstate | 玩家之前的状态。 |
返回
它总是在过滤器脚本中首先被调用。例子
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
new vehicleid = GetPlayerVehicleID(playerid);
AddVehicleComponent(vehicleid, 1010); // Add NOS to the vehicle
}
return 1;
}